Groups | Blog | Home
all groups > coldfusion flash integration > april 2005 >

coldfusion flash integration : Multiple results variables Flash


mike e
4/20/2005 9:06:47 PM
I need to create a webservice that returnes multiple results.
Example: http://tinyurl.com/cg2gz

I am able to create a web service that retunrs an array but i need it
to return predefined results
USERNAME: String (string)
NAME: String

here is my current code.

any help would be great.

<cfcomponent>

<cffunction name="getSessioninfo" returntype="string" access="remote">

<cfargument name="username" required="yes" hint="Username" type="string">

<cfquery name="accountinfo" datasource="useraccounts">

Select * from pl_accounts

</cfquery>

<cfreturn accountinfo>

</cffunction>

</cfcomponent>
mike e
4/20/2005 9:22:37 PM
I think i am way off and am just not getting this quite yet
Kiriran
4/21/2005 6:36:39 AM
you could return the results in a struct

<cfset myResult = StructNew() />
<cfset myResult.USERNAME = "#username#" />
<cfset myResult.Name = "#NAME#" />
<cfreturn #myResult#>

and in flash

#include "NetServices.as"

NetServices.setDefaultGatewayUrl('http://www.yourdomain.com/flashservices/gatewa
y');
var gw = NetServices.createGatewayConnection();
var server = gw.getService("folder/component", this);
server.getSessioninfo();
function getSessioninfo_Result(res) {
trace(res.NAME);
trace(res.USERNAME);
// loop through the struct(object in flash) and get all properites
for (var i in res) {
trace("res."+i+" = "+res);
}
}
AddThis Social Bookmark Button