Reputation: 303
Can someone please give a simple example of where we could use capture mode rather than bubbling mode for a Flash Player event?
Most of the time we are using bubbling mode and we set useCapture
to false (when adding an event listner). What would be the ideal situation to use the capturing phase?
Upvotes: 2
Views: 182
Reputation: 5497
Basically if you want to stop propagation, you should use the capturing phase. For example, you have a default keyboard listener, and you want to cancel that in a rare condition. There are some points when you may want to use the capturing phase, but those can be achieved without it. To understand capturing and bubbling phase, see image below:
Upvotes: 2