Hi Steve,

Thanks for the sample code.  I was able to come up with something quite similar 
to what you have posted.

One question still remains, though.  I tried to issue a timer.stop() command 
when for example, all the text values have been displayed in the label control, 
but the timer event does not seem to stop.

How to specifically stop the timer once all the messages have been displayed?

Thanks.

Angelo




________________________________
From: valdhor <[email protected]>
To: [email protected]
Sent: Saturday, 24 October, 2009 2:07:16
Subject: [flexcoders] Re: Delay / Pause between script executions

  
Here is a simple example:

<?xml version="1.0" encoding="utf- 8"?>
<mx:Application xmlns:mx="http: //www.adobe. com/2006/ mxml" layout="vertical"
    creationComplete= "onCreationCompl ete()">
    <mx:Script>
        <![CDATA[
            private var labelTimer:Timer;
            private var messages:Array = [    "This is my first message", 
                                            "This is my second message", 
                                            "This is my last message"];
            
            private function onCreationComplete( ):void
            {
                labelTimer = new Timer(5000); // 5 Seconds
                labelTimer.addEvent Listener( TimerEvent. TIMER, 
labelTimerTriggered );
                labelTimer.start( );
            }
            
            private function labelTimerTriggered (event:TimerEven t):void
            {
                timerLabel.text = messages[labelTimer .currentCount % 
messages.length] ;
            }
        ]]>
    </mx:Script>
    <mx:Label id="timerLabel" text="This is my first message"/>
</mx:Application>

HTH


Steve


--- In flexcod...@yahoogro ups.com, Angelo Anolin <angelo_anolin@ ...> 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