Thursday, June 11, 2009

T is for Timer

The Timer is a utility class in the flash.utils package. A timer's job is to fire off events at specified intervals.

The below ActionScript shows how to create a Timer instance and start it.

   import flash.utils.Timer;
import flash.events.TimerEvent;

// create a timer which fires every second (1000 ms)
var timer:Timer = new Timer( 1000 );

// add a listener to the timer
timer.addEventListener( TimerEvent.TIMER, handleTimerEvent );

// start the timer
timer.start();

Learn more about the ActionScript Timer at Flex After Dark...

No comments:

Post a Comment