I am fairly new to ActionScript so forgive me if this is a simple question. I
have set up a CFC to return a query object with 2 columns and 4 rows. They are
menu items I wish to add to a menu in Flash. I have set up my service and
responder, all of which seems to work fine, but I am having trouble addressing
the result object. I have debugging working and it shows that a recordset has
returned with the expected elements. When I try to use
trace(result.getLength());, I get an error message telling me that the method
does not exist for the object. Here is my ActionScript....
import mx.remoting.Service;
import mx.services.Log;
import mx.rpc.RelayResponder;
import mx.rpc.FaultEvent;
import mx.rpc.ResultEvent;
import mx.remoting.PendingCall;
import mx.remoting.RecordSet;
import mx.remoting.debug.NetDebug;
NetDebug.initialize();
if (init == null) {
init = true;
var tracService:Service = new Service(
"http://127.0.0.1/flashservices/gateway",
new Log(),
"flashservices.TracFunctions",
null,
null);
}
var pc:PendingCall = tracService.getMenuItems(0);
pc.responder = new RelayResponder( this, "getMenuItems_Result",
"getMenuItems_Fault" );
function getMenuItems_Result(result:ResultEvent)
{
trace(result.getLength());
}
function getMenuItems_Fault(fault:FaultEvent)
{
//display fault returned from service
messageDisplay.text = fault.fault.faultstring;
}
Any help would be appreciated. If there are any good examples of connecting
to a CFC and iterating through the records, it would be great if you could
point me to them.
Thanks,
Scott
feiloiram - 21 Sep 2004 09:49 GMT
Change your getMenuItems_Result -function to :
function getMenuItems_Result(re:ResultEvent)
{
trace(re.result.length);
}
this should work, No?
SpunScott - 22 Sep 2004 00:57 GMT
Yep, that did the trick. Thanks for the reply!
Scott