1 Reply Latest reply on May 27, 2007 9:22 AM by DaveCon

    Timer Bug when repeatCount in Constructor is 0 (AS3)

    DaveCon Level 1
      I'm finding that, in some cases, creating a Timer (in AS3) with the second parameter repeatCount = 0 causes the timer to fail to trigger. I created a new .fla file and added the code below to frame 1:

      var fadeTimer:Timer = new Timer(100);
      fadeTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onFadeOut);

      function onFadeOut(event:TimerEvent):void {

      With this code the handler is never entered. Calling the Timer constructor with only a single parameter (delay) causes the default value of 0 to be used for the second parameter, repeatCount. If I explicitly pass in repeatCount:

      var fadeTimer:Timer = new Timer(100, 0);

      the same problem occurs. However, if I change the 0 to a 1 the handler is called. I've used the 0 value for repeatCount in other cases where it works correctly. In those cases, the code is in an external ActionScript (.as) file instead of in the .fla. This looks like a bug to me.

      David Salahi