I have been stuggling with getting remoting working for a database result in AS 3 and ColdFusion. I am hoping that somebody can help me out with this.


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.names.getnames", responder);



/*without the for loop in onResult (trace window [Object][Object])

with the foor loop nothing is traceed, but no errors

*/

function onResult(responds:Object):void {

	for(var i=0; i<responds; i++){

		trace(responds[i].toString());

	}

}



function onFault(responds:Object):void {

	//loop over the fault structure

	for (var i:String in responds) {

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

	}

}

The cfc


 <cfcomponent>

        <cffunction name="getNames" acces="remote" returntype="query" output="yes">

                <cfquery datasource="johnny_flash" name="allNames">

                    SELECT Names, Comments

                    FROM Titles

                </cfquery>

            <cfreturn allNames>

        </cffunction>

    </cfcomponent>

By |2009-04-05T22:27:05+00:00April 5th, 2009|