[flexcoders] Re: Transferring Data through Cairngorm methodology

2006-10-03 Thread laidezmon
Sorry for the late reply. 

Ben you and Paul are correct your fixes work fine for me thanks. 

I also checked out that login example, but my problem with the login
example, is that instead of passing data into the backend service,
which is what my java beans are set to accept, they want to pass a
fully constructed AS object. 

Now I understand both could work, but I wanted to know specifically
how to do it passing data. The reason is, that in the instance I am
consulted to rewrite an existing java app, I want to be able to pass
exaclty what is there already so as little backend pieces need to be
re-written as possible.

Thanks all for your help.


--- In flexcoders@yahoogroups.com, ben.clinkinbeard
[EMAIL PROTECTED] wrote:

 I didn't read every line of your code but I think this is your
 problem: You are creating and passing your custom AuthenticateEvent
 object, which has the loginName and password properties, but then you
 are trying to access data.loginName and data.password in your command. 
 
 Try this:
 
 var ae:AuthenticateEvent = event as AuthenticateEvent;
 delegate.doLogin(ae.loginName, ae.password);
 
 HTH,
 Ben
 
 --- In flexcoders@yahoogroups.com, laidezmon laidezmon@ wrote:
 
  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:

[flexcoders] Re: Transferring Data through Cairngorm methodology

2006-09-28 Thread laidezmon
O and one other thing, when I created the authenticate event class, I
created two params

public var loginName : String;
public var password : String;

I dont know if thats important or not.

--- In flexcoders@yahoogroups.com, laidezmon [EMAIL PROTECTED] wrote:

 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/
 





[flexcoders] Re: Transferring Data through Cairngorm methodology

2006-09-28 Thread ben.clinkinbeard
I didn't read every line of your code but I think this is your
problem: You are creating and passing your custom AuthenticateEvent
object, which has the loginName and password properties, but then you
are trying to access data.loginName and data.password in your command. 

Try this:

var ae:AuthenticateEvent = event as AuthenticateEvent;
delegate.doLogin(ae.loginName, ae.password);

HTH,
Ben

--- In flexcoders@yahoogroups.com, laidezmon [EMAIL PROTECTED] wrote:

 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/
 





RE: [flexcoders] Re: Transferring Data through Cairngorm methodology

2006-09-28 Thread Paul Williams
I think you will need to perform a cast to access the properties of your
AuthenticateEvent instance (this is why you got a compiler error). The
cast is achieved as follows:

var authenticateEvent : AuthenticateEvent = AuthenticateEvent( event );

So your command's execute function will look like this:

public function execute (event : CairngormEvent):void
{
  
  if( !CruiseModelLocator.getInstance().authenticated  )
  {
var delegate : LoginDelegate = new LoginDelegate( this );

// Do a cast
var authenticateEvent : AuthenticateEvent = AuthenticateEvent( event
);

// Now extract your login details
var loginName = authenticateEvent.loginName;
var password = authenticateEvent.password;

// Pass details to your delegate
delegate.doLogin(loginName, password);
  }
  else  
  {
Alert.show( Logged In already! );
return;
  }
}

I hope this solves your problem, but feel free to post again if you are
unfamiliar with casting and need more explanation.

Paul

-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of laidezmon
Sent: Thursday, September 28, 2006 2:41 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Transferring Data through Cairngorm
methodology

O and one other thing, when I created the authenticate event class, I
created two params

public var loginName : String;
public var password : String;

I dont know if thats important or not.

--- In flexcoders@yahoogroups.com, laidezmon [EMAIL PROTECTED] wrote:

 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






 





--
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