Home Tutorials Forums Articles Blogs Movies Library Employment Press
Prev Previous Post   Next Post Next
Old 10-22-2009, 09:06 PM   #1
Join Date: Sep 2008
Posts: 53
Default e.currentTarget question

Basically I have 16 buttons which I want to change colour when turned on and off kinda thing using colourTransform. I have achieved this by using 16 event listners and 16 functions but know there must be a better approach. I kinda got it working with one function using e.currentTarget but cant figure out to store the on/off state of each button to send to the one function whilst using e.currentTarget. E.G. Turn one button on and will have to click another twice to turn it on.

How could this be solved. Hope this makes sense. Thx.

ActionScript Code:
b1.addEventListener(MouseEvent.CLICK, onPattern, false, 0, true); b2.addEventListener(MouseEvent.CLICK, onPattern, false, 0, true); function onPattern(e:MouseEvent):void{      on1 = on1+1     if(on1 >= 2){     on1 = 0     colorInfo1.greenOffset = 0;     colorInfo1.blueOffset = 0;     colorInfo1.redOffset = 0;           e.currentTarget.transform.colorTransform = colorInfo1;     }     if(on1 == 1){                     colorInfo1.greenOffset = 20;     colorInfo1.blueOffset = -100;     colorInfo1.redOffset = -65;       e.currentTarget.transform.colorTransform = colorInfo1;     }         }
The thought of Death is a lot worse than Death itself!
MadBeat is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT. The time now is 04:16 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.