flash remoting

Seems like I am not able to fix my remoting code. Here is the actions panel


import flash.net.*;

var gateway:NetConnection = new NetConnection();

var responder:Responder=new Responder(onResult,onFault);



// name the default cf test server on this machine

gateway.connect("http://localhost/flashservices/gateway/");



// name of the cfc and the function

gateway.call("com.cfcs.testing.GetResults", responder);





function onResult(responds:Object):void {

	trace("cfc result"+":"+" "+responds.toString());

}



function onFault(responds:Object):void {

	//loop over the fault structure

	for (var i:String in responds) {

		trace( i + ":" + responds[i] );

	}

}

The file Testing.cfc(I have tested this cfc and it works perfect!


<cffunction name="getResults" access="remote" returntype="query">

   <cfquery name="qEmails" datasource="johnbarrett">

     SELECT *

     FROM testing

   </cfquery>

  <cfreturn qEmails>

</cffunction>

output

2 Replies to “flash remoting”

  1. I am not familiar with ColdFusion, so I can’t tell if that class looks ok. But it looks like there are a few syntax errors in your ActionScript. I think the method call should be “Testing.getResults” (capitalization), since that is how your class name and method are written in ColdFusion?

    Also, you can try looping over your result object (like you do with the error method) to see what’s in there. I have a feeling you already tried this though, and that’s where you’re seeing the undefined.

Leave a Reply

Your email address will not be published. Required fields are marked *