I'm using Flash CS4 with AS3. I want a timer to call a function at 50 ms intervals for 100 times. however the timer takes much longer than it should, which adds up to 1677 ms (1.677 seconds!) too much after 100 repeats. Am I missing something here or is the timer THAT inaccurate?
Code
function test(event:TimerEvent):void{
trace("GetTimer(): " + getTimer() + " || Timer.currentCount: " + _timer.currentCount);
}
var _timer:Timer = new Timer(50, 100);
_timer.addEventListener(TimerEvent.TIMER, test);
_timer.start();
Trace Output:
GetTimer(): 74 || Timer.currentCount: 1
GetTimer(): 140 || Timer.currentCount: 2
GetTimer(): 209 || Timer.currentCount: 3
GetTimer(): 275 || Timer.currentCount: 4
GetTimer(): 340 || Timer.currentCount: 5
GetTimer(): 407 || Timer.currentCount: 6
GetTimer(): 476 || Timer.currentCount: 7
GetTimer(): 542 || Timer.currentCount: 8
GetTimer(): 608 || Timer.currentCount: 9
GetTimer(): 677 || Timer.currentCount: 10
......
GetTimer(): 3340 || Timer.currentCount: 50
......
GetTimer(): 6677 || Timer.currentCount: 100
Thanks for help.
Regards,
Chris