User Guide
Guidelines for Flash applications 123
You can also use escape and unescape for decoding. For a complete list of URL-encoded special
characters, see www.macromedia.com/support/flash/ts/documents/url_encoding.htm.
You must typically process information before you send it to the server, so it’s formatted in a way
that the server understands. When the server receives the data, it can be manipulated in any
number of ways and sent back to the SWF file in a format that it can accept, which can range
from name/value pairs to complex objects.
Note: Your application server must have the MIME type of its output set to
application/x-www-urlform-encoded. If that MIME type is missing, the result is usually unusable
when it reaches Flash.
There are other formats for sending data, ranging from XML, Macromedia Flash Remoting, web
services, server-side ActionScript (SSAS), or you can even send data using the MovieClip class’s
getURL method.
The
POST method sends variable names and their corresponding values in the HTML header, and
the
GET method sends the name/value pairs in the browser’s URL. The total number of characters
you can send using the
GET method is limited, so use the POST method if you are sending more
than a hundred characters.
There are many ways to send data to a server and receive data using Flash. The following table
shows you some of the ways:
Send data Description
LoadVars.send and
LoadVars.sendAndLoad
Sends name/value pairs to a server-side script for processing.
LoadVars.send sends variables to a remote script and ignores any
response.
LoadVar.sendAndLoad sends name/value pairs to a
server and loads or parses the response into a target
LoadVars
object.
XML.send and
XML.sendAndLoad
Similar to LoadVars, but XML.send and XML.sendAndLoad send XML
packets instead of name/value pairs.
getURL
Using the getURL() function or MovieClip.getURL method, it is
possible to send variables from Flash to a frame or pop-up
window.
Flash Remoting Introduced in Flash MX, Flash Remoting lets you easily exchange
complex information between Flash and ColdFusion, ASP.NET,
Java, and more. You can also use Flash Remoting to consume
web services.
Web services Flash MX Professional includes the WebServiceConnector
component that lets you connect to remote web services, send
and receive data, and bind results to components. This lets Flash
developers quickly create Rich Internet Applications without
having to write a single line of ActionScript.
It is also possible to consume remote web services using
WebServiceClasses, which can require writing complex
ActionScript.