Tuesday, July 22, 2008

Timer

var theTimer:Timer=new Timer(1000, 0);//(delay, zero is infinite, or any other number is the repeat count)
theTimer.start();
theTimer.addEventListener(TimerEvent.TIMER, proceed);
theTimer.addEventListener(TimerEvent.TIMER_COMPLETE, done); //when done with all repeats (not possible here because of zero)
}
function proceed(e:TimerEvent):void {
trace("tick every second");
}
function done(e:TimerEvent):void {
trace("done");
}

No comments: