title: AS3 - dispatch custom event with parameter (not working)
body: <p>I read a lot of topics about dispatching event but I can't make my code work. 
  <a href="https://stackoverflow.com/questions/12590082/how-to-dispatch-an-event-with-added-data-as3">This topic</a> and <a href="https://stackoverflow.com/questions/5728258/as3-dispatch-custom-event-from-class-to-class">this topic</a> are closed to what I would like to do, but it's not working in my case. </p>
  
  <p>Here is the situation : </p>
  
  <ul>
  <li>My scene is a battle field and has two ships</li>
  <li>Each ship knows when it is touched by a fire, so it has to inform the scene that contains the graphic interface</li>
  <li>So the ship dispatch a custom event with itself as parameter, so the scene knows when a ship is touched and which ship</li>
  </ul>
  
  <p>I have 3 classes :</p>
  
  <ol>
  <li>The custom event class is an event that has a property "Ship"</li>
  <li>The EventDispatcher class</li>
  <li>The symbole class that corresponds to my scene and listen to the event</li>
  </ol>
  
  <p>1) CustomEvent class</p>
  
  <pre><code>public class FightEvent extends Event
      {
          public static const SHIP_TOUCHED:String = "SHIP_TOUCHED"; //type
          public var object:Ship = null; //object to pass
  
          public function FightEvent(type:String, pObject:Ship, bubbles:Boolean=true, cancelable:Boolean=false)
          {
              super(type, bubbles, cancelable);
              object = pObject;
          }
  
          public override function clone():Event
          {
              return new FightEvent(type, object, bubbles, cancelable);
          }
      }
  </code></pre>
  
  <p>2) EventDispatcher</p>
  
  <pre><code>public class Ship extends EventDispatcher
  {
      private function updateDamages():void
      {
          //compute damages
          dispatchEvent( new FightEvent( FightEvent.SHIP_TOUCHED, this ) );
      }
  }
  </code></pre>
  
  <p>3) Scene</p>
  
  <pre><code>public class Fight extends customMovieClip
  {
      private var playerShip:Ship; //I have two ships, player and enemy
      private var enemyShip:Ship;
  
      public function init():void
      {
           stage.addEventListener(FightEvent.SHIP_TOUCHED, onShipTouched);
           //I made a test : the event listener is correctly added
      }
  
      private function onShipTouched(e:FightEvent):void
      {
          //update the graphic interface to show damages
      }
  }
  </code></pre>
  
  <p>My event listener is added, the code passes on the dispatch line, but onShipTouched is not called.</p>
  
  <p>Please help, what did I miss ?</p>
  
  <p>What is the element I didn't understand ?</p>
  
  <p>Is it a good way to use events like this ? or should I set a reference to the scene inside the Ship class ?</p>