topical media & game development

talk show tell print

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

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


  package aeon {
          
          import aeon.events.@fileEvent;
          
          import flash.display.Sprite;
          import flash.events.Event;
          import flash.events.EventDispatcher;
          
          public class @ax-graphic-flex-image-effects-07-source-aeon-Animation extends EventDispatcher {
          
                  private static var sTimerSprite:Sprite = new Sprite();
  
                  private var _running:Boolean;
                  
                  protected var _receiveEnterFrame:Boolean;
  
                  private function addEnterFrameListener(add:Boolean=true):void {
                          if (_receiveEnterFrame) {
                                  sTimerSprite.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
                                  if (add) {
                                          sTimerSprite.addEventListener(Event.ENTER_FRAME, onEnterFrame);
                                  }
                          }
                  }
                  
                  private function onEnterFrame(event:Event):void {
                          if (_running) {
                                  update@ax-graphic-flex-image-effects-07-source-aeon-Animation();
                          }
                  }
                  
                  protected function update@ax-graphic-flex-image-effects-07-source-aeon-Animation():void {}
  
                  public function start():void {
                          _running = true;
                          addEnterFrameListener();
                          dispatchEvent(new @fileEvent(@fileEvent.START));
                  }
  
                  public function stop():void {
                          _running = false;
                          addEnterFrameListener(false);
                  }
                  
                  public function die():void {
                          stop();
                  }
          
                  public function get running():Boolean {
                          return _running;
                  }
  
          }
          
  }


(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.