package
{
import flash.display.Sprite;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class Main extends Sprite
{
private var a:Timer = new Timer(1000);
public function Main():void
{
a.delay = 500; //时间延迟半秒
a.repeatCount = 10; //一共运行10次
a.addEventListener(TimerEvent.TIMER, yunxing); //运行时调用
a.addEventListener(TimerEvent.TIMER_COMPLETE, jieshu); //运行结束时调用
a.start(); //启动计时器
}
//运行时
private function yunxing(evt:TimerEvent):void
{
trace("当前已触发次数:" + a.currentCount);
}
//运行结束后
private function jieshu(evt:TimerEvent):void
{
trace("记时结束!");
}
}
}
{
import flash.display.Sprite;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class Main extends Sprite
{
private var a:Timer = new Timer(1000);
public function Main():void
{
a.delay = 500; //时间延迟半秒
a.repeatCount = 10; //一共运行10次
a.addEventListener(TimerEvent.TIMER, yunxing); //运行时调用
a.addEventListener(TimerEvent.TIMER_COMPLETE, jieshu); //运行结束时调用
a.start(); //启动计时器
}
//运行时
private function yunxing(evt:TimerEvent):void
{
trace("当前已触发次数:" + a.currentCount);
}
//运行结束后
private function jieshu(evt:TimerEvent):void
{
trace("记时结束!");
}
}
}