9 Replies Latest reply on Sep 9, 2008 11:48 AM by VarioPegged

    I have a component that dispatches a  custom event, but it is not heard by listener

    nikos101 Level 2
      I have a component that dispatches a custom event:

      var eventObj:FirstLoginChangePassword = new FirstLoginChangePassword();
      dispatchEvent(eventObj);


      The event class:

      package customevents
      {
      import flash.events.Event;

      public class FirstLoginChangePassword extends Event
      {

      public static const PASSWORD_SUCCESS:String = "success";
      private var command:String;

      //constructor
      public function FirstLoginChangePassword() {
      super(PASSWORD_SUCCESS,true);

      }//end constructor

      //must override the inherited clone function
      override public function clone():Event {

      return new FirstLoginChangePassword();

      }//end clone



      }//end class AddToCartEvent

      }//end package customevents


      however in my main.mxml file I have attempeted to listen to this event:

      private function addListeners():void{
      panelLogin.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
      addEventListener(FirstLoginChangePassword.PASSWORD_SUCCESS,firstLoginChangePasswordHandle r);
      }


      But the event is never heard so this method in my main.mxml does not excecute:

      private function firstLoginChangePasswordHandler(event:FirstLoginChangePassword):void{
      panelLogin.visible=true;
      changePassword.visible=false;
      }


      Does anyone have any ideas?