t.addEventListener(TimerEvent.TIMER,onTimerChange);
t.start();
function onTimerChange(e:TimerEvent):void
{
trace("timer 1 = "+getTimer());
var n:Number = getTimer();
//循环1秒
while((getTimer() - n ) < 1000)
{};
trace("timer 2 = "+getTimer());f
}
输出结果
timer 1 = 156
timer 2 = 1156
timer 1 = 1220
timer 2 = 2220
timer 1 = 2277
timer 2 = 3277
结论:
timer的时间间隔是循环体时间(1秒)+timer设定的间隔时间(50毫秒);