Solved

What is event bubbling in flash(as3) and flex

Posted on 2011-02-17
5
623 Views
Last Modified: 2012-05-11
What is event bubbling in flash(as3) and flex? and how can we use event bubling in as3?
0
Comment
Question by:naveenm_006
  • 2
5 Comments
 

Author Comment

by:naveenm_006
ID: 34923643
What is the use of event bubling? is this concept or technique?
0
 
LVL 20

Accepted Solution

by:
ChristoferDutz earned 250 total points
ID: 34924384
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
 
LVL 37

Expert Comment

by:zzynx
ID: 34924574
0
 
LVL 20

Expert Comment

by:ChristoferDutz
ID: 35414143
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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
Is your company's data protection keeping pace with virtualization? Here are 7 dynamic ways to adapt to rapid breakthroughs in technology.
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now