I am trying to implement a simple login application in cairngorm. I am
having all kinds of problems. 

Heres the deal. 

Basically I have a button which calls a doLogin() function.

private function doLogin():void
{
        var event : AuthenticateEvent = new
AuthenticateEvent(AuthenticateEvent.EVENT_LOGIN);
        event.loginName = loginName.text;
        event.password = password.text;
        CairngormEventDispatcher.getInstance().dispatchEvent( event );
}

this is called from my mxml display page. loginName and password are
text fields on my screen.

The controller is loaded from the main.mxml file, and is already
instantiated, but here is the add command reference for this login
function.

 public function initialiseCommands() : void
       {
          addCommand( AuthenticateEvent.EVENT_LOGIN, LoginCommand );
       }

>From there the loginCommand.as is called and runs its execute method:

public function execute (event : CairngormEvent):void
{
        if( !CruiseModelLocator.getInstance().authenticated  )
        {
        var delegate : LoginDelegate = new LoginDelegate( this );
        delegate.doLogin(event.data.loginName, event.data.password);
        }
        else
        {
        Alert.show( "Logged In already!" );
        return;
        }
}

The delegate is below:

public function LoginDelegate( responder : Responder )
{               
this.service = ServiceLocator.getInstance().getService( "UserManager" );
this.responder = responder;
}
                
public function doLogin(loginName:String, password:String) : void
{                       
var call : Object = service.login(loginName,password);
call.resultHandler = responder.onResult;
call.faultHandler = responder.onFault;  
}

I must be doing something wrong here. But basically I am getting lost
trying to pass the values of those two text boxes, and getting them
all the way through this methodology to the remote object service i am
going to call. It looks for two parameters, loginName and password,
and in this test case loginName actually equals the string loginName
thats the value. 

I have traced the debugger and even gone through the cairngorm ASDoc
stuff, and cannot figure out what I am doing wrong. It mentions the
data attribute, and when I pass into the execute function on the
command, event.data or event.data.loginName I dont get a compile time
error. However nothing is being passed to the service. 

When I look at the debugger trace I see that event does have a
event.data attribute, but its undefined, and also that event has a
event.loginName, and a event.password. Note this is correct, its not
event.data.loginName, but rather event.loginName, and the value is
there from those text boxes.

So it is there, but it dont work. If I pass into the command,
event.loginName I get a compile time error. However it shows in the
debugger as being there. I dont get it. 

I am a newbie to OOP and flex and java, so this could be a really
stupid question. Any help would be greatly appreciated.








--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to