Hi, I've recently changed to Mate as a framework for flex. However am running into a few issues. I want to know how to dispatch events from classes generated via the methodInvoker tag.
<resultHandlers>
<MethodInvoker generator="{LoginSuccess}" method="setCurrentUser" arguments="{[resultObject]}"/>
Then in the class I'd like to dispatch an event.
public function setCurrentUser(calUser:Object):void{
if(calUser != null){
Model.instance.currentUser = calUser as CalUser;
loadOnlineCalendars(Model.instance.currentUser);
}
}
public function loadOnlineCalendars(calUser:CalUser):void{
for(var i:int = 0 ; i<calUser.calConnectors.length; i++){//logic here
dispatchEvent(new CalConnectorEvent(calUser.calConnectors as CalConnector,CalConnectorEvent.LOAD_ONLINE_CALENDAR_EVENT,true));
}
}
The problem is I can't seem to be able to catch the event in the eventMap or even in the application root.
If anyone has any experience with Mate, I'd appreciate some pointers. Perhaps I'm doing this all wrong. I just want to get a result from the server - look at the result and depending on the result contact the server again. Should be quite simple.
Event Map:
<resultHandlers>
<MethodInvoker generator="{LoginSuccess}" method="setCurrentUser" arguments="{[resultObject]}"/>
<ServiceResponseAnnouncer type="result"/>
</resultHandlers>
<faultHandlers>
<ServiceResponseAnnouncer type="fault"/>
</faultHandlers>
</RemoteObjectInvoker>