Hi Michael, When you do b.addEventListener - you're listening for events in "b", not in "c". You should not, architecturally speaking, have "b" listen to "c" at all - that's called tight coupling, which is bad. You should instead do loose coupling, which would have your singleton class "a" listen for events in "c", then when they are heard, tell "b" to do something. Have a public function in "b" that "a" calls when it hears it in "c" (via in class "A", you simply code up a c.addEventListener with the handler, which calls public function in "b"). Make sense?
Bubbling is only up the display hierarchy chain, so in order for that, "B" and "C" would have to both be extensions of DisplayObject (like a Sprite) and "b" would have to be a parent of "c". I don't know what you're doing in your app, so hard to know if one should be a parent of the other or not. So better to do the loose coupling thing I outlined above. Jason Merrill Bank of America Global Learning Learning & Performance Soluions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -----Original Message----- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Mendelsohn, Michael Sent: Tuesday, November 17, 2009 1:59 PM To: Flashcoders; Flash Coders List Subject: [Flashcoders] one class listening for another classes dispatched event Hi list... I have a singleton (let's say it's class a) which contains instances of two different classes, b and c. Class B and C both extend Event Dispatcher. var b:B = new B(); var c:C = new C(); In c's constructor, a custom event is dispatched. I want b to listen for it, but this doesn't work: b.addEventListener(CustomEvent.LISTEN_FOR_C, handler); but this does: c.addEventListener(CustomEvent.LISTEN_FOR_C, handler); How can I have b listen for something dispatched by c? Remember, they're both in class a. I tried bubbles=true for the new custom event, but that doesn't work. Thanks, - Michael M. _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders