Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Flash Remoting / February 2004



Tip: Looking for answers? Try searching our database.

Simple: How Do You Return Multiple Variables?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mannequin3D - 17 Feb 2004 10:21 GMT
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
Ricardo Viana - 19 Feb 2004 11:48 GMT
On 17/02/04 10:21, in article c0spup$5qd$1@forums.macromedia.com,

> 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
[quoted text clipped - 38 lines]
>
> Thank

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.
Mannequin3D - 20 Feb 2004 13:24 GMT
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?
urgwdb01 - 20 Feb 2004 20:28 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.