Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 645
  • Last Modified:

What is event bubbling in flash(as3) and flex

What is event bubbling in flash(as3) and flex? and how can we use event bubling in as3?
0
naveenm_006
Asked:
naveenm_006
  • 2
1 Solution
 
naveenm_006Author Commented:
What is the use of event bubling? is this concept or technique?
0
 
ChristoferDutzCommented:
Flex' event handlich consists of 3 phases ... first is the capturing phase, then comes the targeting phase and after that comes the bubbling phase.

If in a Flex application you click on a button, the click event is recieved at the flash player. In the capturing phase the flash player starts at the root of the application and goes down the tree to find the component that was clicked.
After the component is found, in the targeting phase the event listeners of that component are triggered.
In the bubbling phase the event "bubbles" back down to the root and allows parent components to react on the event.

You have to explicitly tell an event that it can bubble, otherwise this phase will be skipped. You have to explicitly tell an event listener that it should monitor the targetting phase. With an event Listener that listens to the targetting you could be able to "capture" an event and prevent it from targetting a child of the current component.

I usually use bubbling, if I don't want to attach too many event listeners to a component. If for example an ItemRenderer of a list fires a custom "objectxupdated" event then without bubbling I would have to attach a listener to every item. With bubbling I can attach one listener to the list and as soon as the custom event comes bubbling up, I can catch it.

Hope it explains things a little :)
0
 
zzynxSoftware engineerCommented:
0
 
ChristoferDutzCommented:
Oh common' ... the third Question I answered, that you want to be deleted? Please close the issue assigning the points. Otherwise I will deffinitely never answer one of your questions again.
0

Featured Post

New Tabletop Appliances Blow Competitors Away!

WatchGuard’s new T15, T35 and T55 tabletop UTMs provide the highest-performing security inspection in their class, allowing users at small offices, home offices and distributed enterprises to experience blazing-fast Internet speeds without sacrificing enterprise-grade security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now