Return to Snippet

Revision: 4643
at February 14, 2008 11:35 by chrisaiv


Updated Code
var timer:Timer = new Timer(1000, 2);
    timer.addEventListener(TimerEvent.TIMER, blah);
    timer.start();

function blah(e:TimerEvent):void{
     trace("Times Fired: " + e.currentTarget.currentCount);
     trace("Time Delayed: " + e.currentTarget.delay);
}

Revision: 4642
at January 14, 2008 15:15 by chrisaiv


Initial Code
var timer:Timer = new Timer(1000, 2);
       timer.addEventListener(TimerEvent.TIMER_COMPLETE, blah);
       timer.start();

function blah(e:TimerEvent):void{
     trace("Times Fired: " + e.currentTarget.currentCount);
	 trace("Time Delayed: " + e.currentTarget.delay);
}

Initial URL

                                

Initial Description
Flash's Timer Class requires two parameters. The first is the delay (in milliseconds), the second is the amount of times you want the delay to fire.

Initial Title
AS3: Basic Timer example

Initial Tags

                                

Initial Language
ActionScript 3