Thread: [Actionscript 3] passing array button to animate
View Single Post

  #2 (permalink)  
Old 02-09-08, 12:33
Garrod Garrod is offline
Junior Member
 
Join Date: Aug 2008
Posts: 1
Rep Power: 0
Garrod is on a distinguished road
Re: passing array button to animate

Hi.
Timer should work. Something like this :

private function addButtonEvents():void {
for (var i:int=0; i<mc_button_array.length; i++) {
mc_button_array[i].id=i;
mc_button_array[i].alpha=0;
mc_button_array[i].buttonMode=true;
mc_button_array[i].addEventListener(MouseEvent.MOUSE_OVER,mouseOver) ;
mc_button_array[i].addEventListener(MouseEvent.MOUSE_UP,mouseUp);
mc_button_array[i].addEventListener(MouseEvent.ROLL_OUT,mouseOut);
}
timer=new Timer(100,mc_button_array.length);
timer.addEventListener(TimerEvent.TIMER,animateBut ton);
timer.start();
}
private function animateButton(evt:TimerEvent):void {
Tweener.addTween(mc_button_array[evt.target.currentCount-1],{alpha:1,time:0.3,transition:"linear"});
}
Reply With Quote