More fun with bubbles
In response to some good feedback to the previous post on event bubbling, I’ve expanded the Bubbles demo to show how an MXML component can dispatch a custom event, which in turn bubbles up and is handled by a grandparent container defined in ActionScript. I’ve also commented the code to help clarify the difference between target and currentTarget, and added id’s to the UI components to make the value of the target property more readable.
When you open the new demo, click on the Feedback tab to see the custom event dispatched and handled. As always, right-click on the application to view and download the source. When you look at the code, notice the constructor arguments in CustomClickEvent.as:
public function CustomClickEvent( message:String, type:String=EVENT_CUSTOM_CLICK, bubbles:Boolean=true, cancelable:Boolean=false)
The value of bubbles defaults to true, since the CustomClickEvent’s entire purpose in life is to bubble. (Don’t you love bubbly personalities?)

