I got following problem: when i create new Timer object with default "repeatCount" = 0 argument and fire my timer it doesn't work ! if i test it with any other value it works. Added some traces to see what's going on but everything seems to work ok so i'm confused. Here is my simple class
public final TestService
public function TestService():void
_timer = new Timer(5000);
trace(_timer.currentCount); // says 0
trace(_timer.hasEventListener(TimerEvent.TIMER_COMPLETE)); // says true
trace(_timer.running); // says true
private var _timer:Timer;
private function refreshTest(event:TimerEvent):void
As i said when with default repeatCount=0 refreshTest function is never reached, when i change it to 1 or sth it suddenly works ! Am i missing something ?
I know i can get around it easily but it drives me NUTS that it doesn't work like it should ! Any ideas ? i'm on flex SDK 4.1 btw but i should point when i change it to other it doesn't work either
According to the documentation, Timer dispatches the following events -
|Dispatched whenever a Timer object reaches an interval specified according to the Timer.delay property.|
|Dispatched whenever it has completed the number of requests set by Timer.repeatCount.|
It seems like you need the timer event rathar then the timerComplete event...
That was it ! can't believe i missed that subtle difference. i guess night coding isn't my "thing". Thanks for quick reply !