CPedrick
07-03-2008, 04:48 PM
I want to be able to apply a color transformation to each of a number of movie clips each containing a single letter, and then remove the color transformation later based upon a mouse click event.
I have set up the various letters as individual movie clips, each of which listens for the click event, and can use the code shown below to readily apply the transformation to a randomly clicked letter.
public function clickLetter(event:MouseEvent) {
var rOffset:Number; //red offset
var bOffset:Number; //blue offset
rOffset = transform.colorTransform.redOffset + 100;
bOffset = transform.colorTransform.redOffset - 100;
event.currentTarget.transform.colorTransform = new ColorTransform(1, 1, 1, 1, rOffset, 0, bOffset, 0);
} //end function clickLetter
The problem comes if I want to be able to remove the transformation when a particular letter is clicked again.
Is there some way I can test to see if a transformation has been applied?
TIA,
Carolyn
I have set up the various letters as individual movie clips, each of which listens for the click event, and can use the code shown below to readily apply the transformation to a randomly clicked letter.
public function clickLetter(event:MouseEvent) {
var rOffset:Number; //red offset
var bOffset:Number; //blue offset
rOffset = transform.colorTransform.redOffset + 100;
bOffset = transform.colorTransform.redOffset - 100;
event.currentTarget.transform.colorTransform = new ColorTransform(1, 1, 1, 1, rOffset, 0, bOffset, 0);
} //end function clickLetter
The problem comes if I want to be able to remove the transformation when a particular letter is clicked again.
Is there some way I can test to see if a transformation has been applied?
TIA,
Carolyn