Thursday, May 15, 2008

AS3 setInterval

// new Timer([interval], [repeat]);
var myTimer:Timer = new Timer(500, 10);

myTimer.addEventListener(TimerEvent.TIMER, myFunction);

function myFunction(event:TimerEvent):void {
        trace(myTimer.currentCount);
}

// start the timer
myTimer.start();

1 comment:

Erik said...

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