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

Reply via email to