Today I have been trying to integrate a color picker into the application so that the line can change color. I am now committed to using AS3, which offers a color picker component. I managed to figure out how to include it in the application and to target the drawing api movie clip (called myDrawing) as the beneficiary of the color changes.
Here is the code:
//remember to import the class!!
cpColor.addEventListener(ColorPickerEvent.CHANGE,changeColor);
function changeColor(evt:ColorPickerEvent):void {
var newColorTransform:ColorTransform = myDrawing.transform.colorTransform;
newColorTransform.color = evt.color;
myDrawing.transform.colorTransform = newColorTransform;
}
Unfortunately it doesnt quite work because in order to activate the color picker, it has to be 'clicked' which is not possible for a cursor that is being controlled by motion detection. So although I know that in theory it will work, I need to figure out how to make it activate using a MouseOver event instead. Progress hopefully will follow soon.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment