Thursday, 17 November 2011

Flash timer

var time:int=300

var myTimer:Timer = new Timer(1000, 300); //This is making the clock countdown one second from the clock, the 1000 represents 1 second and the 300 is for how many times it will countdown a second.
myTimer.addEventListener(TimerEvent.TIMER, runOnce);
myTimer.start();

function runOnce(event:TimerEvent):void {
time--
clock.text=String(time);
}

No comments:

Post a Comment