It's something like this:

import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.mxml.RemoteObject;
import mx.rpc.remoting.Operation;

...


public var srv:RemoteObject;

...

private function init():void
{
    srv = new RemoteObject("pojo");
    srv.showBusyCursor = true;
    var op1:Operation = srv.getConfigForCompany;
    op1.addEventListener(ResultEvent.RESULT, showConfig);
    var op2:Operation = srv.getConfiguredCompanies;
    op2.addEventListener(ResultEvent.RESULT, showConfig);
}

...

Note, you should always add a fault handler too.

Also, I'm assuming that you want to add event listeners at the operation
level as you ultimately want to create different handlers (otherwise
you'd just add the event listeners to the service).

Finally, note that you can also add per-invocation responders that
handle result and faults.

Pete


-----Original Message-----
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Paul Dale
Sent: Friday, January 11, 2008 7:37 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Add methods to RemoteObject in AS?

Howdy ... anyone know what the AS equivilent for  this is?

 <mx:RemoteObject id="srv" showBusyCursor="true" destination="pojo">
    <mx:method name="getConfigForCompany" result="showConfig(event)" />
    <mx:method name="getConfiguredCompanies" result="showConfig(event)"
/> </mx:RemoteObject>

I'm not seeing how to add a handler for a specific method on a remote
object in AS ...

Many thanks :)

Paul


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