Event Listener Priority : Event « Development « Flash / Flex / ActionScript






Event Listener Priority

 
package {
  import flash.display.*;
  import flash.net.*;
  import flash.events.*;

  public class Main extends Sprite {
    public function Main() {
      var urlLoader:URLLoader = new URLLoader(  );
      // Registration order determines execution order
      urlLoader.addEventListener(Event.COMPLETE, completeListenerA);
      urlLoader.addEventListener(Event.COMPLETE, completeListenerB);
      urlLoader.load(new URLRequest("someFile.txt"));
    }

    private function completeListenerA (e:Event):void {
      trace("Listener A: Load complete");
    }

    private function completeListenerB (e:Event):void {
      trace("Listener B: Load complete");
    }
  }
}

        








Related examples in the same category

1.Handling Events: a simple application that draws successive random lines
2.Add Event listener
3.Responding to Event.ACTIVATE and Event.DEACTIVATE
4.Listeners for the Event.RESIZE event must be registered with Flash Player's Stage instance,
5.The Event.MOUSE_LEAVE Event
6.Responding to Event.RESIZE.
7.Preventing Default Event Behavior