You definitely want to use Timer here.  When you create a timer you can set the 
interval for the timer and you can set the number of times you want the timer 
to execute.  Using your example you'd get something like:

myTimer = new Timer(5000, 3); 

This will create a timer that executes every 5 seconds and it will do this 
three times.  Now you need two event handlers to handle the actual code 
execution.  Timer has two events of interest "timer" and "timerComplete".  
TimerComplete is dispatched on the final execution of the timer (based on how 
many iterations you set).  Timer is dispatched on every other execution.  So 
wire up some event listeners for these two events and you're pretty much in 
business.  The only other thing you might need to know is what iteration the 
Timer is on.

Fortunately Timer has a property, currentCount, that tells you the current 
iteration.  You can access this in your event handler by reading event.target 
as this will be pointing to your Timer object.

Check out the livedocs page for any details I missed: 
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/utils/Timer.html

--- In flexcoders@yahoogroups.com, Angelo Anolin <angelo_ano...@...> wrote:
>
> Hi Flexcoders,
>  
> I know this may sound very elementary but I cannot figure the hell out of me 
> how to achieve this.
>  
> I have a label control.  I want to display different messages after every 5 
> seconds, such as:
>  
> myLabel.text = "This is my first message"
> // Need to delay for about 5 seconds here
>  
> myLabel.text = "This is my second message"
> // Need to delay for about 5 seconds here
>  
> myLabel.text = "This is my last message"
> 
> I cannot figure out how to properly use the pause or timer utilities in 
> achieving this.
>  
> Any idea would be appreciated.
>  
> Thanks.
> Regards,
> Angelo
>


Reply via email to