all groups > macromedia flash flash remoting > november 2005 >
You're in the

macromedia flash flash remoting

group:

Flash Remoting Result scope


Flash Remoting Result scope cdcmicro
11/23/2005 12:00:00 AM
macromedia flash flash remoting:
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

Re: Flash Remoting Result scope ufitzi
12/1/2005 7:14:14 PM
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


Re: Flash Remoting Result scope cdcmicro
12/7/2005 7:44:52 PM
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

AddThis Social Bookmark Button