Can anyone explain to me, why stopping the timer after 50 runs doesn’t work in the following code:
var timer:Timer = new Timer(50);
timer.addEventListener(TimerEvent.TIMER, flopActions);
timer.start();
var a:Number = 0;
function flopActions(evt:TimerEvent):void
{
a++;
trace(a); // 1, 2, 3, 4, 5, 6, ...
if(a == 50)
{
trace("please stop ;-)" ); // output: please stop ;-)
evt.target.stop(); // doesn't work
timer.stop() // doesn't work
}
}