Flash CS3 - Flash CS4

Free tutorials and scripts for all.
Actionscript 3.0

passing array button to animate

This is a discussion on passing array button to animate within the advanced Actionscript 3.0 forums, part of the Flash CS3 eng category; guys, need some help with some as3 error. basically i have 4 movieclips (not dynamically generated) on the root and ...


Go Back   Forum Flash CS3 Flash CS4 > English Forums > Flash CS3 eng > advanced Actionscript 3.0

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 30-08-08, 23:31
Member
 
Join Date: Nov 2007
Posts: 59
Rep Power: 2
gwulfwud is on a distinguished road
passing array button to animate

guys,

need some help with some as3 error.

basically i have 4 movieclips (not dynamically generated) on the root and i want to animate them once it enters the first frame. so i have this code right, i placed all of them in one array and goes to a function that basically sets their properties..


Code:
       
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);
            animateButton(mc_button_array[i]);
            }
        }
        
        private function animateButton(evt:Event):void
        {
            id=evt.target.id;
            Tweener.addTween(mc_button_array[id],{alpha:1,time:0.3,transition:"linear"});
        }
now what i want to do after setting the properties is to animate them so that the buttons will appear one by one and not simultaneously..i just don't know how to pass the current value of the array to another function so that it animates that MC first then goes back to set the property of the next MC and animate it again...

im not sure if im passing the value of the mc properly to the next function that animates the object..

somebody please help...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #2 (permalink)  
Old 02-09-08, 12:33
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"});
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Tags
animate, array, button

Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads

Thread Thread Starter Forum Replies Last Post
Passing variables from HTML to Flash CS3 Flep Tutorials 24 25-11-08 22:36
Actionscript 3 next button / nav as3 help? oli.stinger Actionscript 3.0 newbies 3 24-07-08 15:59
button in as3 keshaodhomane Actionscript 3.0 newbies 1 20-03-08 02:37
passing DisplayObject references trough XML dedavai advanced Actionscript 3.0 1 21-01-08 10:11
passing DisplayObject references trough XML dedavai advanced Actionscript 3.0 0 21-01-08 09:43


All times are GMT. The time now is 21:10.


Powered by vBulletin versione 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC4
Forum SiteMap


FlepStudio
by Filippo Lughi
P.IVA 03605860406