In one class I use dispatchEvent(new
Just below that I execute code only if isDefaultPrevented()
In the event handler for the ToggleEvent I set
e.preventDefault() based on a condition.
My tests indicate that the
if(!toggleEvent.isDefaultPrevented()) code will not be reached till
after the event handler for the ToggleEvent has returned, which is
good, but I did not think I could depend on this, as I thought Flex
was asynchronous in this regard.
I would have thought that code following dispatchEvent()
would execute immediately after the call to dispatchEvent(), and
not wait till the event handler is done. In this case
isDefaultPrevented() is false, as it has not been set yet in the
Can I rely on the fact that code after dispatchEvent()
(checking isDefaultPrevented()) will not execute until after all
event handlers for the dispatched event have returned?