title: Flex Custom Event dispatching
body: <p>I got a question about event dispatching in flex.</p>
  
  <p>my goal is to get a custom event loaded up with some data and than bubble up to the eventlistener.</p>
  
  <p>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.</p>
  
  <p>so inside my mainapp i add and listener like this:</p>
  
  <pre><code>this.addEventListener("UserInfoEvent", userInfoHandler);
  </code></pre>
  
  <p>the custom UserInfoEvent.as looks like this</p>
  
  <pre><code>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);
    } 
   }
  }
  </code></pre>
  
  <p>and finally the dispatcher inside the AMF Service class looks like this:</p>
  
  <pre><code>private var dispatch:EventDispatcher = new EventDispatcher;  
  var userInfoEvent:UserInfoEvent = new UserInfoEvent("UserInfoEvent", ego);
  dispatch.dispatchEvent(userInfoEvent);
  </code></pre>
  
  <p>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.</p>
  
  <p>Can anyone tell me what i'm doing wrong?</p>