2 Replies Latest reply on Jan 13, 2009 9:50 AM by *gsb*

    Broadcast Event to all objects

      I'd like to broadcast an event to all loaded modules. If I understand bubbling correctly events can bubble up, but not across. Lets say that a user logs out of the application. How do I pass this "event" to all loaded modules.
        • 1. Re: Broadcast Event to all objects
          matthew horn
          I think what you have to do is add listeners in the modules to listen for the event.

          matt horn
          flex docs
          • 2. Re: Broadcast Event to all objects
            *gsb* Level 1
            When in doubt, I use the system's root "dispatchEvent and addEventListener/removeEventListener."

            Here's an example:

            SystemManager.getSWFRoot(this).dispatchEvent( new ModulesEvent( ModulesEvent.MODULE_DATA_EVENT) );


            SystemManager.getSWFRoot(this).addEventListener(ModulesEvent.MODULE_DATA_EVENT, onDataArrival, false, int.MAX_VALUE);


            SystemManager.getSWFRoot(this).removeEventListener(ModulesEvent.MODULE_DATA_EVENT, onDataArrival);