2 Replies Latest reply on Mar 30, 2011 2:14 PM by Radek-Kozak

    Strange Timer class behavior

    Radek-Kozak

      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);

                _timer.addEventListener(TimerEvent.TIMER_COMPLETE,refreshTest,false,0,true);

       

                trace(_timer.currentCount); // says 0

                trace(_timer.hasEventListener(TimerEvent.TIMER_COMPLETE)); // says true

       

                _timer.start();

       

                trace(_timer.running); // says true

       

           }

       

           private var _timer:Timer;

       

           private function refreshTest(event:TimerEvent):void

           {

                trace("timer works");

           }

       

      }

       

       

      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