Quantcast
Viewing all articles
Browse latest Browse all 2218

How do the event bus work?

I don't think I understand how the event bus works. I have two ActionScript classes. An instance of one of the class can dispatch the DataRefreshInvocationEvent event and cause a refresh. An instance of the other class dispatches the same event and nothing happens.

 

The class that can successfully dispatch the DataRefreshInvocationEvent, EventManager, is like the ChassisEventManager class in the chassis-ui example. The class that doesn't successfully dispatch the event is a regular ActionScript class that extends EventDispatcher. Both classes have the same Event metadata before the class definition.

 

[Event(name="{com.vmware.core.events.DataRefreshInvocationEvent.EVENT_ID}",

       type="com.vmware.core.events.DataRefreshInvocationEvent")]

 

Both dispatchEvent calls are made from the regular ActionScript class.

 

This dispatch from the regular ActionScript class does not cause a refresh:

        dispatchEvent(new DataRefreshInvocationEvent(DataRefreshInvocationEvent.EVENT_ID));

 

but when the same line is changed to dispatch from EventManager the refresh happens:

 

        EventManager.instance.dispatchEvent(new DataRefreshInvocationEvent(DataRefreshInvocationEvent.EVENT_ID));

 

I'd like to understand what does a class need to do for the event bus to see its message dispatches.

 

Thanks for help,

 

 

-Darrell


Viewing all articles
Browse latest Browse all 2218

Trending Articles