4 Replies Latest reply on Sep 15, 2009 9:45 AM by David_F57

    AddEventListeer doesn't works

    germanpena

      Well i have the next code but the EventListener doesn't works when i press the button. I don't know what is wrong.... Can someone help me???

       

      My Custom Event

       

      package classes.CustomEvents
      {
          import classes.ValueObjects.Usuario;
         
          import flash.events.Event;

       

          public class AuthEvent extends Event   
          {
              public static const AUTH_CUSTOM_EVENT:String = "AUTH_CUSTOM_EVENT";
              public var authUser:Usuario;
             
              public function AuthEvent(type:String, authUser:Usuario)
              {
                  super(type);
                  this.authUser = authUser;
              }
             
              override public function clone():Event{
                  return new AuthEvent(type, authUser);
              }       
          }   
      }

       

       

      MyCustomComponent

       

      <mx:Metadata>
              [Event(name="authCustomEvent", type="classes.CustomEvents.AuthEvent")]
          </mx:Metadata>

       

      private function clickHandler():void{
                       var authUserEvent:AuthEvent = new AuthEvent("authCustomEvent", usuario);
                      dispatchEvent(authUserEvent);
                  }

       

       

      My App

       

      private function init():void{
                      canvasLogin.addEventListener(AuthEvent.AUTH_CUSTOM_EVENT, authEventHandler);               
                      PopUpManager.addPopUp(canvasLogin, this, true);
                      PopUpManager.centerPopUp(canvasLogin);               
                  }
                 
                  private function authEventHandler(event:AuthEvent):void{
                      usuarioApp = event.authUser;
                  }

       

      Help please!!!