On 3/4/15, 2:22 PM, "Jeffry Houser" <[email protected]> wrote:

>On 3/4/2015 4:30 PM, Mark Line wrote:
>> Hi,
>>
>> I was wondering if someone could confirm something for me about event
>> processing. I know if you two events are dispatched one after another,
>>the
>> second event will be dispatched only after all handlers of the first
>>event
>> are executed and the dispatchEvent method is returned.
>
>  I did not think this was true.  Isn't Event dispatching a
>multi-threaded process?

I don’t know if there are guaranteed behaviors when ActionScript Workers
are involved, but without workers, there is only one ActionScript thread
running, and events are serviced as others have described.
The Player may have received events asynchronously or in other
non-ActionScript VM threads, but I’m pretty sure the handlers are all
executed by the one ActionScript thread which means that all handlers and
handlers for events fired in the handling of the first event must finish
before the second event’s handlers begin to run.  Handlers can be skipped,
of course, via stopPropagation and stopImmediatePropagation.

>
>> Eg would Flex make sure the event handlers registered for my
>> this.addEventListener(FlexEvent.CHANGE_START,
>> eventTwoHandler) before return flow to the button1_clickHandler.
>
>  No; Flex would not because event handlers would be triggered in
>parallel.  There is no way to conclusively determine when an event
>handler will fire in relation to other events or event handlers.
>

Is there a specific scenario you are thinking of where parallel event
handlers might occur?

-Alex

Reply via email to