topical media & game development

talk show tell print

#graphic-flex-image-effects-07-source-aeon-AnimationHold.ax

#graphic-flex-image-effects-07-source-aeon-AnimationHold.ax [swf] [flash] flex


  package aeon {
  
          import aeon.events.AnimationEvent;
  
          import flash.events.TimerEvent;
          import flash.utils.Timer;
          
          public class @ax-graphic-flex-image-effects-07-source-aeon-AnimationHold extends Animation {
          
                  private var _timer:Timer;
                  
                  public function @ax-graphic-flex-image-effects-07-source-aeon-AnimationHold(time:Number) {
                          _timer = new Timer(time, 1);
                          _timer.addEventListener(TimerEvent.TIMER_COMPLETE, onEndAnimation, false, 0, true);
                  }
          
                  private function onEndAnimation(pEvent:TimerEvent):void {
                          stop();
                          dispatchEvent(new AnimationEvent(AnimationEvent.END));
                  }
          
                  override public function stop():void {
                          super.stop();
                          if (_timer && _timer.running) {
                                  _timer.removeEventListener(TimerEvent.TIMER_COMPLETE, onEndAnimation);
                                  _timer.stop();
                          }
                  }
          
                  override public function start():void {
                          _timer.start();
                          super.start();
                  }
          
          }
          
  }


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.