Search code examples
actionscript-3apache-flexevent-bubblingevent-propagation

Event Bubbling, and Stop Propagation


What is the difference between event.bubbles to false for any event, and setting event.stopPropagation() or stopImmediatePropagation() while handling event?

I'm using Flex4 with AS3.


Solution

  • Setting bubbles to false means the event does not bubble up the display list at all.

    stopPropagation() and stopImmediatePropagation() make the current event listener the last to process an event.

    The difference between stopPropagation() and stopImmediatePropagation() is that stopImmediatePropagation() will not only prevent the event from moving to the next node, but it will also prevent any other listeners on that node from capturing their events.