Yes, people have created central event handlers that redispatch events. I think Cairngorm does this. Probably find examples in the archives or google.
Tracy ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alex Harui Sent: Friday, March 30, 2007 12:29 PM To: flexcoders@yahoogroups.com Subject: RE: [flexcoders] Re: Dispatching Event Question? If you listen to systemManager for the event in capture phase you'll see it. ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of paulwelling Sent: Friday, March 30, 2007 9:54 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Dispatching Event Question? Hello Roman, I am trying to avoid spec'ing who will do the dispatching and just have my component listen for the event no matter who dispatches it. Any ideas? The A.addEventListener(..) seems to couple more than I want... Thanks, Paul --- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> , "Roman Protsiuk" <[EMAIL PROTECTED]> wrote: > > When you are adding an event listener the only thing that tells who is to > dispatch the event is who's addEventListener() is called. I mean if you are > calling addEventListener(...) this means that you are listening to 'this' > that will dispatch the event. If a.addEventListener(...) then 'a' will > dispatch it. > > What you need is smth like: > instanceOfA.addEventListener("myEvent", myBListenerFunc); > inside of the B instance. > > R. > > On 30 Mar 2007 08:25:28 -0700, paulwelling <[EMAIL PROTECTED]> > wrote: > > > > Hello, > > > > Question on disipatching events that I hope someone can clear up... > > > > I have two custom components, A and B created at the Application level. > > > > I want to send a custom event from A to B. > > > > Inside of B creationComplete, I have addEventListener("myEvent", > > myBListenerFunc); > > > > Inside of A, on a button click, I dispatchEvent(new Event("myEvent")) > > > > Obviously I would like the function on B, myBListenerFunc() to be > > called, but is not. > > > > I'm sure I can do this without having to tell B that A is the > > dispatcher (in B, A.addEventListner("myEvent",myBListnerFunc);) > > > > Thanks, > > Paul > > > > > > >