topical media & game development

talk show tell print

actionscript-events-Main.ax

actionscript-events-Main.ax [swf] flex


  package {
    import flash.display.*;
    import flash.net.*;
    import flash.events.*;
    import flash.system.*;
    
    public class @ax-actionscript-events-Main extends Sprite {
      public static const START:String = "START";
      
      private var loader:Loader;
            
      public function @ax-actionscript-events-Main() {
        loader = new Loader();
        loader.contentLoaderInfo.addEventListener(Event.INIT, 
                                                  initListener);
        loader.load(new URLRequest("actionscript-events-Module.swf"));
  
        stage.addEventListener(Event.MOUSE_LEAVE, mouseLeaveListener);
      }
  
      private function mouseLeaveListener (e:Event):void {
        // Share a built-in event
        loader.contentLoaderInfo.sharedEvents.dispatchEvent(e);      
      }
  
      private function initListener (e:Event):void {
        // Share a custom event
        LoaderInfo(e.target).sharedEvents.dispatchEvent(
                                                       new Event(@ax-actionscript-events-Main.START));
      }
    }
  }
  


(C) Æliens 27/08/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.