Don't sweat it Andy... ActionScript has gotten a pretty steep learning curve
in the last 2 versions and it's a lot to take on. Now on to your
questions...
How is any of this code triggered?
--// The function "onClick" starts it all off. It triggers the
service.testCall() and sets to functions to handle whether it succeeds or
fails.//--
Does this have to be run via a web browser or can it be run from within the
IDE?
--// Both. It should run successfully in either. //--
Can I return a query object to Flash or does it have to be a structure?
--// It can be either actually. If you return back a Structure, it will look
like an object(associative) array in flash. So in CF, if you returned:
<cfset obj = StructNew()>
<cfset obj.firstname = "John">
<cfset obj.lastname = "Doe">
Then the result in Flash is:
function handleCallSuccess (result:ResultEvent){
// Dot syntax
trace (result.firstname);
trace (result.lastname);
// Array syntax
trace (result["firstname"]);
trace (result["lastname"]);
}
If the result is a query object, than you can look to result.items array,
which is the same as a CF array of structs.
//--
Anyway, I greatly appreciate your input to this point, but I'll just have to
come up with another method, passing in the values via the query string,
because I know that works.
--// Honestly, I know it's confusing, but don't give up. Once you understand
it, you'll save a *ton* of time. Remoting is definitely worth the hassle...
Cheers,
Kevin
-----Original Message-----
From: Andy Matthews [mailto:[EMAIL PROTECTED]
Sent: February 24, 2006 9:26 AM
To: CF-Talk
Subject: RE: Getting data into Flash 8
Honestly? I don't understand any of that. There's not a bit of that
Actionscript that I recognize.
How is any of this code triggered?
Does this have to be run via a web browser or can it be run from within the
IDE?
Can I return a query object to Flash or does it have to be a structure?
I'm sorry to be so dense but WHY does MM have to make this so complex?
Something as simple as connecting to a database should, at this point, be a
drag and drop thing.
Anyway, I greatly appreciate your input to this point, but I'll just have to
come up with another method, passing in the values via the query string,
because I know that works.
<!----------------//------
andy matthews
web developer
ICGLink, Inc.
[EMAIL PROTECTED]
615.370.1530 x737
--------------//--------->
-----Original Message-----
From: Kevin Aebig [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 23, 2006 4:16 PM
To: CF-Talk
Subject: RE: Getting data into Flash 8
It's using certain development idea's that complicate things for beginners
like using Delegates to handle listeners.
Here's a bare-bones example... comments included. Let me know if any of this
is confusing.
Cheers,
!k
/* --------- CODE-START ----------- */
import mx.remoting.*;
import mx.rpc.*;
import mx.remoting.debug.NetDebug;
// This is gatewayurl. Replace the 'my.serverdomain.com' with the domain of
// the server that is running your CFC
var gatewayUrl:String = "http://my.serverdomain.com/flashservices/gateway";
// This is the actual folder path to the service, only it's separated by
// dots instead of slashes.
// So this one, using the domain from above as an example would be
// 'http://my.serverdomain.com/test/services/testService.cfc'
var pathToComponent:String = "test.services.testService";
// Initialize the gateway as well as the service
NetDebug.initialize();
var service:Service = new Service(gatewayUrl, null, pathToComponent);
function onClick()
{
var pc:PendingCall = service.testCall();
pc.responder = new RelayResponder(this, "handleCallSuccess",
"handleCallError");
}
function handleCallSuccess (result:ResultEvent)
{
// Deal with the data as you see fit. If you're unsure what kind of
// data you're getting back, take a
// look at the NetConnection Debugger. It can show you what the data
// looks like as well as the result and the calls
// being made.
}
function handleCallError(fe:FaultEvent)
{
// Look at the FaultEvent Object if you want to show any warnings or
// log the error.
// Flash's docs show some good examples how to easily get to and use
// this object.
}
/* --------- CODE-END ----------- */
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:233373
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54