so in AS2 I used to do actions for btns. First I put them into an Array then I loop through then
I will call them like so myBtn*.onRelease = function {}… so now in AS3 Im trying to do the same thing
and it works just fine but I was wondering if is a more efficient way to the same.
Here is the example
[AS]import caurina.transitions.;
import caurina.transitions.properties.;
ColorShortcuts.init();
DisplayShortcuts.init();
var aBtn:Array = new Array(my_mc, my_mc2, my_mc3);
for (var i:uint = 0; i < aBtn.length; i++){
aBtn*.addEventListener(MouseEvent.ROLL_OVER, ROLLOVER, false, 0, true);
aBtn*.addEventListener(MouseEvent.ROLL_OUT, ROLLOUT, false, 0, true);
aBtn*.addEventListener(MouseEvent.CLICK, CLICKED, false, 0, true);
}
/*aBtn[0].addEventListener(MouseEvent.ROLL_OVER, ROLLOVER);
my_mc2.addEventListener(MouseEvent.ROLL_OVER, ROLLOVER);
my_mc3.addEventListener(MouseEvent.ROLL_OVER, ROLLOVER);
my_mc.addEventListener(MouseEvent.ROLL_OUT, ROLLOUT);
my_mc2.addEventListener(MouseEvent.ROLL_OUT, ROLLOUT);
my_mc3.addEventListener(MouseEvent.ROLL_OUT, ROLLOUT);
my_mc.addEventListener(MouseEvent.CLICK, CLICKED);
my_mc2.addEventListener(MouseEvent.CLICK, CLICKED);
my_mc3.addEventListener(MouseEvent.CLICK, CLICKED);*/
function ROLLOVER(e:MouseEvent):void {
Tweener.addTween(e.target,{_frame:40, time:1});
Tweener.addTween(e.target, {_color:0xFB9804, time:1});
}
function ROLLOUT(e:MouseEvent):void {
Tweener.addTween(e.target, {_frame:0, time:1.5, transition:“easeOutExpo”});
Tweener.addTween(e.target, {_color:0x4926D9, time:1});
}
function CLICKED(e:MouseEvent):void {
trace(e.target.name);
}[/AS]
Thank You.