Solved

What is event bubbling in flash(as3) and flex

Posted on 2011-02-17
5
635 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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Vertical ScrollBar on RichTextArea 2 1,092
Issue running Flash Builder application in Google Chrome 2 938
Shape with multiple lineStyle assigned 6 254
Play RTMP without Flash 3 745
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…
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

679 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