Bubbling has very few real-life applications outside of low-level mouse and keyboard events. When you have nested objects, you might not be interested that the user clicked on some tiny little graphic inside your button, you are much more interested in the fact that they clicked on the button, so that is where you listen for the event. Likewise, you might want to know that they clicked somewhere on your form, so that you can focus the form, but not have to listen for the click event on every item.
The bubbling mechanism is exposed in ActionScript so that the native mouse and keyboard events are implemented transparently, without some mysterious behind-the-scenes magic. If you start adding and using custom bubbling events, things can get a little bit dangerous. I don't think there are many legitimate use cases. One danger is that a child component might dispatch a bubbling event that has the same name as an event dispatched by one of its parents. Any object listening for the event on the parent would also be notified by the event from the child. Bubbling events affect every parent of the event source, right up to the SWF root, so it's pretty much just as bad as using a root reference to store arbitrary properties and methods. Peter On 8/31/06, barry.beattie <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote: > > > Say you've got a DataGrid that uses a ComboBox as an > > itemRenderer. You probably wouldn't want the logic that handles the > > change event of the CB inside that itemRenderer component, you would > > want it in the parent of the DataGrid > > Ben, please forgive my lack of Flex experiance, but can I ask why not? > > shouldn't the ComboBox be seen as a self-contained component that > should handle all it's own stuff? it's goal is to capture a users > selection, the data of which is held as "public var CbSelection:String;". > > lets say you want to have a custom version of this that is a listbox - > it has a property of "mandetoryItemsSelected" where "2" means that the > user has to select 2 items. Surely the validation of that goes into > the itemRenderer component, not the parent of the datagrid? The output > of the component is a list of the two items, and the parent shouldn't > care whether it's a comboBox or a group of CheckBoxes? > > or am I wrong? if so, please correct me. > thanx > barry.b > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > > > > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/flexcoders/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

