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

macromedia flash flash remoting

group:

Simple: How Do You Return Multiple Variables?


Simple: How Do You Return Multiple Variables? Mannequin3D
2/17/2004 10:21:13 AM
macromedia flash flash remoting:
I'm using FlashMX and ColdFusionMX. I've opened up the connection the database
in Actionscript, pinpointed the function within the CFC and have successfully
populated a text field in Flash with the data retrieved from the CFC

How do I now pull data from a second function in the CFC without opening up a
new connection to the database in Flash? Here's my Actionscript

[q]var sectionName = "home"

if(isGatewayOpen == null)
isGatewayOpen = true


NetServices.setDefaultGatewayUrl("http://www.mannequin3d.com/flashservices/gatew
ay")
gw = NetServices.createGatewayConnection()
server = gw.getService("cfcDir.home", this)
server.getAbout(sectionName)

function getAbout_result(result)
textdata.text = result.items[0].content; // works
imageDir.text = imageDirectory; // does not wor
}[/q]And here is the CFC

[q]<cffunction name="getAbout" returntype="query" access="remote"
<cfargument name="sectionName" required="yes" type="string" default="home"
<cfquery name="content" datasource="ds"
Select sectionName from homeAbou
Where sectionName = '#arguments.sectionName#
</cfquery
<cfreturn content
</cffunction

<cffunction name="getDirectory" access="remote"
<cfset imageDirectory = "downloads"
<cfreturn imageDirectory
</cffunction>[/q]I am trying to return both "content" and "imageDirectory"...
and I'm unsure how to do this. My ActionScript above successfully retrieves the
first variable - "content" - but it doesn't retrieve the second one.

Thank
Re: Simple: How Do You Return Multiple Variables? Ricardo Viana
2/19/2004 11:48:55 AM
On 17/02/04 10:21, in article c0spup$5qd$1@forums.macromedia.com,
[quoted text, click to view]
Once you are connected to the gateway you only need to call
The getAbout function and getDirectory from actionscript.
You need to set up a responder for each function I think.



Re: Simple: How Do You Return Multiple Variables? Mannequin3D
2/20/2004 1:24:17 PM
This doesn't help me. Let me rephrase this. Maybe this will make things simpler.

When I do [i]this:[/i]

[q]NetServices.setDefaultGatewayUrl("http://www.mannequin3d.com/flashservices/ga
teway");
gw = NetServices.createGatewayConnection();
server = gw.getService("cfcDir.home", this);
server.getAbout(sectionName);[/q]I am saying "open up 'home.cfc' and run the
'getAbout()' function that's sitting there."

Fine.

Now. How do I run a [i]different[/i] function?

I can't just simply change "server.getAbout(sectionName)" to
"server.getDirectory();" -- that won't work. I keep hearing from people that
once you open up a connection to the database you can make multiple requests.
But HOW, if the above doesn't work?


Re: Simple: How Do You Return Multiple Variables? urgwdb01
2/20/2004 8:28:01 PM
I believe you replace Not only the server.NEWFUNCTION but also the Results with
your new function.
You can do this right underneath your first function without another
connection.
It would look like this.

Service.function1();
Service.function2();

function function1_Result(result) {
datagrid1.setDataProvider(result);
}
function function2_Result(result) {
datagrid2.setDataProvider(result);
}

Hope this helps.
AddThis Social Bookmark Button