1 Reply Latest reply on Sep 28, 2009 5:29 AM by CoreyRLucier

    Timers don't fire when effects run

    KenichiM Level 1

      I just came across this problem and was wondering if this is new for Gumbo or was always a Flex limitation.  If an effect (sequence, parallel, fade, etc) is running then Timer Time events do not fire, they will start firing again after the effect stops running or some other interruption like a scroll takes place.

        • 1. Re: Timers don't fire when effects run
          CoreyRLucier Adobe Employee

          Hey there, would you mind posting a small sample app. I've never personally experienced such a thing.  The sample below seems to work just fine.  Click the button to start an effect on the button, and then click the start timer button. You'll see the timer firing while the button is animating.

           

          <?xml version='1.0' encoding='UTF-8'?>
          <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                         xmlns:s="library://ns.adobe.com/flex/spark"
                         xmlns:mx="library://ns.adobe.com/flex/halo">
             
              <fx:Script>
                  <![CDATA[
                      import flash.utils.Timer;
                      [Bindable]
                      private var ticks:int = 0;
                      private var timer:Timer;
                      private function startTimer():void
                      {
                          timer = new Timer(250);
                          timer.addEventListener("timer", onTimer);
                          timer.start();
                      }
                     
                      private function onTimer(e:Event):void
                      {
                          ticks++;
                      }
                  ]]>
              </fx:Script>

              <s:Button id="myButton" label="clickMe" click="myEffect.play()" />
              <s:Button y="50" label="Start Timer" click="startTimer()"/>
              <s:Label text="Timer Ticks: {ticks}" y="100"/>
             
              <fx:Declarations>
                  <s:Move id="myEffect" target="{myButton}" duration="6000" xFrom="0" xTo="500"/>
              </fx:Declarations>
                      
             
          </s:Application>