You might want to use the one written by Alex Uhlmann  as a starting (or restarting) point. You can find it here:
http://www.alex-uhlmann.de/flash/adobe/blog/cairngormlogin/CairngormLogin.html

 

Then just Right-Click and View Source. You can of course download the project from this “View Source” perspective at the bottom left corner.

 

-Evan

 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of laidezmon
Sent: Thursday, September 28, 2006 7:22 AM
To: [email protected]
Subject: [flexcoders] Transferring Data through Cairngorm methodology

 

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





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.9/458 - Release Date: 9/27/2006


--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.407 / Virus Database: 268.12.9/458 - Release Date: 9/27/2006

Reply via email to