Hi there!
I got a question about event dispatching in flex.
my goal is to get a custom event loaded up with some data and than bubble up to the eventlistener.
my main application has and AMF service request inside which calls an service class. that class is supposed to dispatch an event when the AMF service request returns a result or fault and the main application is listening for that event.
so inside my mainapp i add and listener like this:
this.addEventListener("UserInfoEvent", userInfoHandler);
the custom UserInfoEvent.as looks like this
package events
{
import flash.events.Event;
import logic.Ego;
public class UserInfoEvent extends Event
{
private var ego:Ego;
public function UserInfoEvent(type:String, ego:Ego)
{
super(type);
this.ego = ego;
}
override public function clone():Event
{
return new UserInfoEvent(type, ego);
}
}
}
and finally the dispatcher inside the AMF Service class looks like this:
private var dispatch:EventDispatcher = new EventDispatcher;
var userInfoEvent:UserInfoEvent = new UserInfoEvent("UserInfoEvent", ego);
dispatch.dispatchEvent(userInfoEvent);
However, this event never reaches the main application. Looking closely to it with the debugger, i found out that when the event is dispatched the listeners property of it is set to null.
Can anyone tell me what i'm doing wrong?