Using Timer Class in Flex.

Using Timer Class we can raise an Event at specified Time and even at the completion of the specified Time.

The below example uses two events, one if fired for every sec and other one after the completion of the Time specified.First define a var of type Timer with time specified ,which specifies the time interval you wanted to raise the event.

var mTimer:Timer=new Timer(1000,5);//ticks for 5 sec’s

Then add events to it for every sec and completion of specified time like below.


Now start time.


Define the two function you wanted to call for below.

private function Countsec(e:TimerEvent):void
private function Comple(e:TimerEvent):void
lbltime.text=”Time Complete”;

Here lblTime is the Label Control id in Flex.

<mx:Label id=”lbltime” x=”374″ y=”167″ width=”369″ height=”61″ fontWeight=”bold” fontSize=”30″/>

Thats all the Time is set for 5 sec, Enjoy the code. 


5 Responses to Using Timer Class in Flex.

  1. Martin says:

    nice ticket…simple and it works fine 🙂

  2. arthipesa says:

    saviour code, 🙂 thank you bro..

  3. Thank you, its great for beginners

    Thank you

  4. Ragu says:

    Really super and simple.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: