Timer

Here’s the timer, much easier to control than the old setInterval (or onEnterFrame)

var timer:Timer = new Timer(1000) // one second
timer.addEventListener(TimerEvent.TIMER, updateTimer);
function updateTimer(event:TimerEvent):void {
// do something
};

Then you can start it with

timer.start();

and stop it with

timer.stop();

Check out the other properties and methods here.

This entry was posted on Thursday, June 11th, 2009 at 12:39 pm and is filed under Flash. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply