Hello,
I'm new to Flash Remoting, and Flash in general, but experienced in JavaScript
and Perl. I'm supporting a Flash developer, and want to write some re-usable
code that he can use to retrieve and store some data on our Web server's
database.
On the server-side, I'm using AMF-Perl, and I have that working, and a working
sample AS. What I can't seem to figure out is how to get the result object (or
a copy of it) out of the callback function's scope without having to manipulate
a Flash display object inside the callback. Any suggestions?
Thanks!
-Clark
ufitzi - 01 Dec 2005 19:14 GMT
You need to create an object in the main timeline that you can reference from
with the result handler.
Look at the RecordSet object, it is designed to handle the result object.
Then, from inside the result handler, you can initialize your
"_root.RecordSetVariable"
Be careful, since you are creating an object, you'll have to declare teh
variable on the main timeline, then call the constructor from the result method.
onResult(re)
{
RecordSetVariable = new RecordSet(re.result);
}
...or along those lines.
You'll find some good code examples in the ActionScript Dictionary (built into
Macromnedia Flash).
Hope this helps.
bh
cdcmicro - 07 Dec 2005 19:44 GMT
Thanks for the help. I pretty much figured it out on my own before reading
your post. ActionScript isn't quite as flexible as JavaScript. It looks like
you can't actually return the resultset to the caller like:
var rs = getRemotingResultSet();
myObj = rs.getItemAt(0);
As you say, it's a little more static where you have to instantiate a global
object to receive the resultset before you make the remoting call, then set the
global object in the callback.
-Clark