Chapter 20. Flash Remoting

Introduction

Flash Remoting is a technology that enables you to easily connect your Flash movie to a server-side back end. Prior to Flash Remoting, the only options for transferring data were through XML or URL-encoded data strings, both of which require you, the developer, to serialize and deserialize the data on both the client and server. The terms serialize and deserialize refer to the process of formatting complex data so that it can be transferred between programs, and then translating the serialized data back into the appropriate datatype. For example, consider the scenario in which you want to pass an ActionScript array from Flash to a server-side script using LoadVars. To do this, you have to first convert the array into a string (serialization). Here is an example of a serialized array in which vertical pipes are used as delimiters between elements:

myArray=val0|val1|val2

Not only do you have to serialize the data before sending it, but you have to deserialize it in the server-side script to convert it back into an array. Furthermore, the data may not be correctly interpreted when it is deserialized. XML and URL-encoded strings allow you to send string data only. So, for example, if your array has Boolean values and you serialize it as follows:

myArray=true|false|true

when you deserialize it, the resulting array will be an array of strings with the values “true”, “false”, and “true”. Furthermore, although arrays are fairly simple to serialize, ...

Get Actionscript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.