title: send dispatchEvent to child : example doesn't work? (flash, as3)
body: <p>I'd like to send a <code>dispatchEvent</code> to a loaded swf, put into a <code>movieclip</code>. I found <a href="https://stackoverflow.com/questions/1387568/as3-dispatchevent-from-a-parent-swf-to-a-child-swf">a good topic about it</a> but my example doesn't work, the "trace" doesn't appear.</p>
  
  <p><strong>Edit.</strong></p>
  
  <ul>
  <li>I have a <code>main.as</code></li>
  <li>another class: <code>submenu.as</code>, that I import in <code>main.as</code></li>
  <li>when I click on the "main" menu in <code>main.as</code>, I would like to send a <code>dispatchEvent</code> to <code>submenu.as</code> (because I'd like the submenu to change one of its items, when I click on the "main menu" in <code>main.as</code>, so I need to send a <code>dispatchEvent</code> to <code>submenu.as</code>)</li>
  <li>so I put a <code>dispatchEvent</code> in the method <code>clickButton</code> in my <code>main.as</code>: <code>Event.CHANGE</code></li>
  <li>and in the <code>submenu.as</code>, I'd like to listen to this <code>event.CHANGE</code>, and that's what I wrote below</li>
  </ul>
  
  <p><strong>End of edit.</strong></p>
  
  <p>In my parent class: each time I click on the menu:</p>
  
  <pre><code>dispatchEvent(new Event(Event.CHANGE));
  </code></pre>
  
  <p>or </p>
  
  <pre><code>stage.dispatchEvent(new Event(Event.CHANGE));
  </code></pre>
  
  <p>and in my child class :</p>
  
  <pre><code>public function initStage (e:Event){
  […]
  this.parent.addEventListener(Event.CHANGE, switchItem, false, 0, true);
  
  private function switchItem(pEvent:Event):void
  {
      trace("PARENT_CHANGED");
  }   
  </code></pre>
  
  <p>Any idea?</p>