> Is bubbling then set to true by default?

As Alex said, "Events have a constructor parameter as to whether the
event bubbles or not." In other words it is up to the code that creates
the event to decide whether it bubbles or not. For each event dispatched
by the Player or Flex Framework classes, the Adobe(r) Flex(tm) 2
Language Reference documents whether it bubbles or not. For example,
look at the doc for the (inherited) 'click' event of Button. It has
 
    The event has thefollowing properties:
 
    Properties     Values
    ---------------     ----------
    bubbles         true
    ...
 
- Gordon

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of qnotemedia
Sent: Friday, March 23, 2007 5:59 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Event Dispatching through more than one
component



Argh! It worked!

So all I had to do actually was set useCapture in the 
systemManager.addEventListener to true, and it worked right away. Is 
bubbling then set to true by default?

Also, should I be in the habit of removing the listener when popups 
are removed? I've been noticing that in other code I've looked at 
online.

Thanks Alex! Makes a whole lot more sense now!
- Chris

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> The top of the display list is the stage. The stage always has one
> child (the root) which in Flex apps is a SystemManager. The app 
and all
> popups are children of the systemManager.
> 
> 
> 
> Stage -> SystemManager -> Application
> 
> PopUp1
> 
> PopUp2
> 
> 
> 
> The event model in Flash/Flex is based on the DOM event model
> http://www.w3.org/TR/DOM-Level-3-Events/events.html
<http://www.w3.org/TR/DOM-Level-3-Events/events.html> 
> 
> If you search for bubbling and capture in our docs you'll find 
easier to
> read descriptions.
> 
> 
> 
> But basically, when PopUp2 dispatches an non-bubbling event, the 
stage
> first dispatches the event in capture phase, then the SystemManager 
in
> capture phase, then PopUp2 as a regular event.
> 
> If the event was a bubbling event, the same would happen, but then
> SystemManager would dispatch it again in bubbling phase and finally 
the
> Stage in bubbling phase.
> 
> 
> 
> addEventListener has a parameter as to whether you want to listen in
> capture phase or not. Events have a constructor parameter as to 
whether
> the event bubbles or not. Capture phase basically allows 
containers to
> supervise and block events going to their children. Bubble phase 
serves
> as notification that the child dispatched an event.
> 
> 
> 
> In theory this makes the Popups even more loosely coupled from each
> other than the other suggestions. Each Popup simply dispatches 
events.
> Other code can capture all events coming from popups (yes, it has to
> know what the event name is). Popups can listen to other popups 
without
> having to watch for their creation and destruction since you are 
going
> to addEventListener on systemManager instead of the actual popups.
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>

[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of qnotemedia
> Sent: Wednesday, March 21, 2007 4:44 AM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Re: Event Dispatching through more than one
> component
> 
> 
> 
> OK, I understood the other responses, but not this one. Agreed that 
I 
> tried setting bubbles to true in my customEvent, and then each 
event 
> instance, and the dispatched event did not pass through embedded 
> windows. But I've never used systemManager, nor do I entirely 
> understand bubbling. Can you forward me to an example or doc 
> explaining this?
> 
> And does this somewhat move away from loosely-coupled components 
(which 
> I'm trying real hard to achieve!).
> 
> Thanks,
> - Chris
> 
> --- In flexcoders@yahoogroups.com
<mailto:flexcoders%40yahoogroups.com>  <mailto:flexcoders%
40yahoogroups.com>
> , "Alex Harui" <aharui@> wrote:
> >
> > Each popup is parented by the systemManager so it won't bubble 
from 
> > one popup to the next. However, each popup can listen to the 
> > systemManager for the event to bubble to it, or listen in capture
> > phase so you don't have to use bubbling.
>



 

Reply via email to