Flash actionscript 3.0: Timer Event in AS3.0

Timer Event in AS3.0

Posted by Sankar.G | Posted in | Posted on 3:59 PM

var min:Number=0;
var myTimer:Timer = new Timer(1000);
myTimer.addEventListener(TimerEvent.TIMER, myFunction);
min_txt.text=String(min);
function myFunction(event:TimerEvent):void
{
sec_txt.text=String(myTimer.currentCount);
if(myTimer.currentCount==10)
{
myTimer.stop();
myTimer.reset();
myTimer.start();
min=min+1;
min_txt.text=String(min);
}
}
myTimer.start();

Create 2 text box and Name it as sec_txt & min_txt and put this script

Comments (0)