Actually I'm looking at Cairngorm 2.2 - possibly earlier versions aren't
strongly typing objects returned.

It would be ro:RemoteObject =
ServiceLocator.getInstance().getRemoteObject('userService') in 2.2. 

Jeff

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Battershall, Jeff
Sent: Monday, September 10, 2007 2:13 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Cairngorm or AS3 question please help


Hmmm....

First of all, what is returning from
ServiceLocator.getInstance().getService() is of type
mx.rpc.remoting.RemoteObject, not Object, and these need to be
pre-defined in your Services.mxml file. Have you done this?
ServiceLocator is your repository of service definitions, not your
UserDelegate class.

All you would be doing in a delegate class is making a call to your
pre-defined services.

Jeff

-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of jairokan
Sent: Monday, September 10, 2007 4:47 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Cairngorm or AS3 question please help


Hi,
I'm using Cairngorm. On one of the Business Delegate classes, I got 
defined 3 services, instantiated on the Business delegate 
constructor. Here an example:
class UserDelegate {

   private var userService: Object;
   private var adminService: Object;
   private var authorizationService: Object;
   private var responder : Responder;

   public function UserDelegate( responder : Responder ) {      
      this.userService = ServiceLocator.getInstance().getService
( "UserService" );
      this.adminService = ServiceLocator.getInstance().getService
( "AdminService" );
      this.authorizationService = ServiceLocator.getInstance
().getService( "AuthorizationService" );
      this.responder = responder;
   }

}

On one of my Cammand classes I create UserDelegate Object using new 
UserDelegate() this is supposed inturn to create the 3 services 
Object as seen in the code above. All is done I think, as expected. I 
call the Command object execute method, where I'm using ONE of the 
services in UserDelegate Object. Precisely I use 
authorizationService, and the behaviour is as expected. Then after 
using another Command instantiating the UserDelegate AGAIN, and using 
DIFFERENT service like userService, the reference is null. Because 
I'm creating a NEW UserDelegate so the service references souldn't be 
null.
Can please please someone say where I got it wrong.

Kind regards



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



Reply via email to