title: Flex event handler not working
body: <p>I have created a custom event in flex 3.5. But the handler is not invoked. How to solve this or what is the way to debug this problem?</p>
  
  <p>The Event class:</p>
  
  <pre><code>package com.saneef.worldlanguages.events
  {
      import flash.events.Event;
  
      public class LanguageEvent extends Event
      {
          public static const LANGUAGE_SELECTED:String = "LanguageSelected";
  
          public function LanguageEvent(type:String,languageid:String)
          {
              super(type);
              this.langid = languageid;
              trace("LanguageEvent: " + this.langid);
          }
  
          public var langid:String;
  
          override public function clone():Event {
              return new LanguageEvent(type, langid);
          }
      }
  }
  </code></pre>
  
  <p>Dispatching:</p>
  
  <pre><code>private function functionOne():void
  {       
      try{
          dispatchEvent(new LanguageEvent(LanguageEvent.LANGUAGE_SELECTED,"STR"));
      }
      catch(e:Error)
      {
          trace(e.message);
      }
  }
  </code></pre>
  
  <p>In the Main application class, EventListener: </p>
  
  <pre><code>protected function application1_initializeHandler(event:FlexEvent):void
  {
    this.addEventListener(LanguageEvent.LANGUAGE_SELECTED,
   application1_LanguageSelectionHandler);
  }
  </code></pre>
  
  <p>The event handler function:</p>
  
  <pre><code>public function application1_LanguageSelectionHandler(event:LanguageEvent):void
  {
      trace("application1_LanguageSelectionHandler: " + event.langid);
      populate_countrya3id_languages(event.langid);
  }
  </code></pre>