0

I know EventDispatcher is capable of firing events in between objects, but how about a global event where any object in the hierarchy can listen and respond to? Is there a recommended way of doing this properly in EaselJS, and is it a good idea in general?

Arbie Samong
  • 1,195
  • 1
  • 15
  • 17

1 Answers1

2

Events can go through any object and any object can listen to any event, you just have to initialize EaselJS events for your custom objects through:

EventDispatcher.initialize(myObject);

If you want it to be globally accessible I think you'd have to use something like window.myGlobalEventHub as the dispatching object, or some other window-variable that can be accessed from anywhere.

olsn
  • 16,644
  • 6
  • 59
  • 65