Hi Jason, thanks for responding!

> Make sense?
Almost.  :-)

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

The EventDispatcher has a private var that's a reference to a custom class that 
extends Sprite.
The Event Dispatcher is instanced in the singleton, it's not on the stage, it 
just directs traffic, so to speak.

> 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.

Yes, that's happening.

> Then have your class listen to the instance of that class for the custom
event you dispatch.

Yes, I'm doing that too.

> 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).

This is the part I'm not getting to work. What I have working is the following:

Singleton
        - has private var EventDispatcher

EventDispatcher
        - has private var CustomSprite

CustomSprite dispatches CustomEvent.

EventDispatcher catches CustomEvent from Sprite.
EventDispatcher dispatches same CustomEvent.  <-- unnecessary step??
Singleton catches CustomEvent from EventDispatcher (passed along from 
CustomSprite).

What I want is:
CustomSprite dispatches CustomEvent
Singleton catches CustomEvent.

Within singleton, this does *not* work:
myEventDispatcher[myCustomSprite].addEventListener...

I have to "pass" the event up the ladder to the singleton.  I'd rather leap 
over the EventDispatcher.

- Michael M.


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to