| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Senior Member
Join Date: Sep 2006
Posts: 123
|
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. Code:
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
Is there some way I can test to see if a transformation has been applied? TIA, Carolyn |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Jan 2008
Location: Exeter, UK
Posts: 263
|
Maybe use a Boolean variable which is 'true' if the movie clip has been clicked, and 'false' if it hasn't been clicked?
ActionScript Code:
The first time a movieclip is clicked, it's 'clicked' property will be undefined (so that first test will fail, and you'll apply the transformation). After that, the above should mean that you can toggle the transformation on and off as many times as you wish. Hope it works! |
|
|
|
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Sep 2006
Posts: 123
|
That worked great!
I had created a workaround where I set the alpha to .9 or 1 to use it as a flag. This is much better. I'm new to AS3, so I didn't know you could create properties like that on the fly, and I didn't want to have to set up some sort of array to track click state for all the letters. Thanks very much!! Carolyn |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Jan 2008
Location: Exeter, UK
Posts: 263
|
That's cool. I'm glad it worked.
I know what you mean. Not many days when AS3.0 doesn't surprise me with something. ![]() Dynamic variables I think they're called. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Testing...123 | bowljoman | Site Check | 0 | 01-17-2008 08:25 AM |
| local(desktop) testing works but not on the server | lporiginalg | Server-Side Scripting | 0 | 07-01-2007 02:19 AM |
| Automation and QTP Testing | curiousgeorge | Flex 2 & 3 | 0 | 01-24-2007 10:36 AM |
| Automated UI Testing of Flash Applications | testmann | Other Flash General Questions | 1 | 07-26-2005 10:00 AM |
| Unit Testing GUI code? | confusednoise | ActionScript 2.0 | 0 | 07-11-2005 10:55 PM |