all groups > macromedia flash flash remoting > september 2004 >
You're in the

macromedia flash flash remoting

group:

Looping over results from CFC


Looping over results from CFC SpunScott
9/20/2004 4:50:05 PM
macromedia flash flash remoting: 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


Re: Looping over results from CFC feiloiram
9/21/2004 8:49:45 AM
Change your getMenuItems_Result -function to :

function getMenuItems_Result(re:ResultEvent)
{
trace(re.result.length);
}


this should work, No?

Re: Looping over results from CFC SpunScott
9/21/2004 11:57:14 PM
Yep, that did the trick. Thanks for the reply!

Scott
AddThis Social Bookmark Button