And I don't see where you are declaring the listener.

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From: [email protected] [mailto:[email protected]] On
Behalf Of Fotis Chatzinikos
Sent: Tuesday, September 01, 2009 4:11 AM
To: [email protected]
Subject: Re: [flexcoders] Why no event dispatched?

 

  

Do what Tracy mentions:

either add bubbles=true in the constructor here:
this.dispatchEvent(new LoginEvent(LoginEvent.FAILED))




On Mon, Aug 31, 2009 at 9:40 PM, Wally Kolcz <wko...@isavepets.
<mailto:[email protected]> com> wrote:

  

My Events: 

package com.isavepets.rm.events
{
    import flash.events.Event;

    public class LoginEvent extends Event
    {
        
        public static const LOGIN:String = "loginEvent";
        public static const LOGOUT:String = "logoutEvent";
        public static const FAILED:String = "loginAttemptFailedEvent";
        
        public var username:String;
        public var password:String;
        
        public function LoginEvent(type:String, bubbles:Boolean=true,
cancelable:Boolean=false)
        {
            super(type, bubbles, cancelable);
        }
        
    }
}

My Listener on the LoginPanel component View:

    public function attemptLogin(username:String, password:String):void {
                this.addEventListener(LoginEvent.FAILED, loginFailed);
                var login:LoginEvent = new LoginEvent(LoginEvent.LOGIN);
                login.username = username;
                login.password = password;
                dispatchEvent(login);
            }



  _____  

From: "Tracy Spratt" <tr...@nts3rd. <mailto:[email protected]> com>
Sent: Monday, August 31, 2009 10:37 AM
To: flexcod...@yahoogro <mailto:[email protected]> ups.com
Subject: RE: [flexcoders] Why no event dispatched?



 

Your event is not set to bubble, so you listener must be:
myLoginManagerInstance.addEventListener();  Is it?

 

Tracy Spratt,

Lariat Services, development services available

  _____  

From:flexcod...@yahoogro <mailto:[email protected]> ups.com
[mailto:flexcod...@yahoogro <mailto:[email protected]> ups.com] On
Behalf Of Wally Kolcz
Sent: Monday, August 31, 2009 12:09 PM
To:flexcod...@yahoogro <mailto:[email protected]> ups.com
Subject: [flexcoders] Why no event dispatched?

 

  

Can anyone tell me what I am missing from this Class that not dispatch the
LoginEvent.FAILED?

package com.isavepets.rm.business
{
    import com.isavepets.rm.events.LoginEvent;
    import flash.events.EventDispatcher;
    import flash.events.IEventDispatcher;
    import mx.collections.ArrayCollection;
    
    public class LoginManager extends EventDispatcher
    {
        
        public var username:String;
        public var role:String;
        public var rescueID:int;

        public function LoginManager(target:IEventDispatcher=null)
        {
            super(target);
        }
        
        public function manageLogin(e:ArrayCollection):Boolean {
            if (e.length !=0){
                DataModel.getInstance().username = e.getItemAt(0).username;
                DataModel.getInstance().role = e.getItemAt(0).role;
                DataModel.getInstance().rescueID = e.getItemAt(0).rescueID;
                return true;
            }else{
                this.dispatchEvent(new LoginEvent(LoginEvent.FAILED));
                /* Alert.show("Incorrect Username and/or Password, Please
Try Again", "Login Failed"); */
                return false;
            }
        }
        
    }
}

 




-- 
Fotis Chatzinikos, Ph.D.
Founder,
Phinnovation
Fotis.Chatzinikos@ <mailto:[email protected]> gmail.com, 



Reply via email to