title: Class implementing IEventDispatcher cannot use Event metadata tag
body: <p>Okay Flex gurus, we have following class</p>
  
  <pre><code>package
  {
      import flash.events.Event;
      import flash.events.EventDispatcher;
      import flash.events.IEventDispatcher;
  
      import mx.controls.Alert;
      import mx.core.IMXMLObject;
  
      [Event(name="progressReady", type="flash.events.Event")]
      public class IndependentClass implements IMXMLObject, IEventDispatcher{
              public var dispatcher:IEventDispatcher;
  
              public function initialized(document:Object, id:String):void{
                      dispatcher = document as EventDispatcher;
                      addEventListener("progressReady", progressReadyListener);
              }
  
              public function progressReadyListener(e:Event):void{
                      Alert.show("progressReadyListener inside");
              }
  
              public function click():void{
                      dispatchEvent(new Event("progressReady", true));
              }
  
              public function addEventListener(type:String, listener:Function, useCapture:Boolean=false, priority:int=0, useWeakReference:Boolean=false):void{
                      if(dispatcher != null){
                              dispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference);
                      }
              }
  
              public function dispatchEvent(event:Event):Boolean{
                      if(dispatcher != null){
                              return dispatcher.dispatchEvent(event);
                      }
                      return false;
              }
  
              public function hasEventListener(type:String):Boolean{
                      if(dispatcher != null){
                              return dispatcher.hasEventListener(type);
                      }
                      return false;
              }
  
              public function removeEventListener(type:String, listener:Function, useCapture:Boolean=false):void{
                      if(dispatcher != null){
                              dispatcher.removeEventListener(type, listener, useCapture);
                      }
              }
  
              public function willTrigger(type:String):Boolean{
                      if(dispatcher != null){
                              return dispatcher.willTrigger(type);
                      }
                      return false;
              }
         }
  
      }
  </code></pre>
  
  <p>And we have following MXML markup:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
             xmlns:s="library://ns.adobe.com/flex/spark" 
             xmlns:mx="library://ns.adobe.com/flex/mx" 
             xmlns:local="*"&gt;
  
  &lt;fx:Script&gt;
      &lt;![CDATA[
          import mx.controls.Alert;
          protected function progressHandler():void{
              Alert.show("progressHandler outside");
          }
      ]]&gt;
  &lt;/fx:Script&gt;
  
  &lt;fx:Declarations&gt;
      &lt;local:IndependentClass id="ic" progressReady="progressHandler()"/&gt;
  &lt;/fx:Declarations&gt;
  
  &lt;s:Button click="{ic.click()}"/&gt;
  &lt;/s:Application&gt;
  </code></pre>
  
  <p>If you run these, you'll notice that the MXML-component can't hear the event. The question is simple, is there some way of getting the Event-metadata tag to work WITHOUT extending EventDispatcher? I would like to keep this class independent and use object composition as much as possible.</p>
  
  <p>And no, I don't want to use ActionScript addEventListener in the MXML-file. It doesn't tell the developer anything like good old Event metadata tag, and besides, that is not the point of this example. :)</p>
  
  <p>Hopefully someone can enlighten what the event metadata tag does behind the curtains.</p>