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
...@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
Thanks Jason. I wasn't sure if a listening for c and calling a function in
b as a result qualifies as tight coupling also between the three classes. In
any case, that was the other plan I had intended on going with. Thanks for the
great answer!
- MM
Merrill, Jason wrote:
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.
So better to do the loose coupling thing I outlined
above.
Tight
4 matches
Mail list logo