What do you mean "The EventDispatcher contains an instance of a sprite."

Normally what you would do is not create an instance of EventDispatcher,
but instead have your custom class extend Sprite (which already extends
EventDispatcher anyway), have that sprite dispatch a custom event.  Then
have your class listen to the instance of that class for the custom
event you dispatch.  So in summary, you write an event class, dispatch
that custom event from the "sprite" class (the custom class that extends
sprite) and listen for that event on that instance in your Singleton
(the fact that it's a Singleton should be irrelevant).  Your singleton
class then has a handler you write that runs when the event is heard. 

Make sense?

Jason Merrill 

Bank of  America  Global Learning 
Learning & Performance Solutions

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: Wednesday, March 17, 2010 1:38 PM
To: Flash Coders List
Subject: [Flashcoders] bubbling listening

Hi list...

I have a singleton that contains an instance of an EventDispatcher.

The EventDispatcher contains an instance of a sprite.

I want that sprite to dispatch a custom event that is listened to by the
singleton, but I can't seem to make it happen, even by saying bubbles =
true.  I could have a listener on the EventDispatcher, then dispatch
another event going one level higher to the singleton, but I'm wondering
if there's a way to bypass that sort of step by step architecture.  I
thought that within the singleton, I could have referred directly to the
sprite itself within the EventDispatcher, but I have not been able to do
that either.

Any feedback is appreciated, 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

Reply via email to