Skip navigation
Currently Being Moderated

Event handling order

Oct 18, 2010 10:11 AM

As simply as possible, I am trying to find out if events are guaranteed to be handled in the order they are dispatched.  Let's say I have the following, simple code:


private function handler1(e:Event):void { .. processing ..}
private function handler2(e:Event):void { .. processing ..}
private function handler3(e:Event):void { .. processing ..}

<SomeComponent myEvent1="handler1(event)" myEvent2="handler2(event)" myEvent3="handler3(event)" ... />


If somewhere in my application (either from within the component itself or another place with the component instantiated), if I dispatch those events in the order of 1, 2, 3, like:


dispatchEvent(new Event('myEvent1'));

dispatchEvent(new Event('myEvent2'));

dispatchEvent(new Event('myEvent3'));


Are those handlers guaranteed to fire in the same order (i.e., handler1, handler2, handler3)...?  Anything I search the internet (read: Google) for concerning "adobe event processing order" or anything similar just refers to the event lifecycle.  I cannot find anything on this specific nuiance though.  Any help is greatly appreciated.


    - Ian

  • Currently Being Moderated
    Oct 18, 2010 11:18 AM   in reply to istrasci

    It is essentially a function call.  Order is guaranteed.

    Mark as:
  • Currently Being Moderated
    Oct 21, 2010 4:23 PM   in reply to Flex harUI

    To elaborate slightly on what Alex said... event handlers for an event are called before dispatchEvent() returns. They are just callbacks from the call to dispatchEvent().


    Gordon Smith

    Adobe Flex SDK Team

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points