It's really just a few steps:

   1. Have your commands implement mx.rpc.IResponder, and define result
   and fault methods in the command.
   2. Call the service directly from the execute() method of the command.
   3. When you call the service, it returns an ASyncToken, and you can
   set the Command to act as the responder by setting token.addResponder(this).

So your command class will look something like this:

import mx.rpc.AsyncToken;

import mx.rpc.IResponder;


 public class InitAppCommand implements ICommand, IResponder

{

public function InitAppCommand(event:CairngormEvent)

{

 }


 public function execute(event:CairngormEvent):void

{

 var service:* = ServiceLocator.getInstance().getRemoteObject( "myService" )
;

 var token:AsyncToken = service.someMethod();

token.addResponder(this);

 }

 public function result(data:Object):void

{

}

 public function fault(info:Object):void

{

}

 }


On Wed, Apr 16, 2008 at 10:33 AM, markflex2007 <[EMAIL PROTECTED]>
wrote:

>   Hi,
>
> I work with Cairngorm for couple months. I use delegate to connect
> with Server and use command to get the data from delegate. Now the
> delegate file and command file are separate files.
>
> Somebody told me I can combine delegate with command so I do not need
> to build so many file.
>
> Do you know some demo online to do this? so I see how to do this.
>
> Thanks for your help.
>
> Mark
>
>  
>

Reply via email to