Collecting and formatting data, Sending and processing data – Adobe Flash Professional CS3 User Manual
Page 481
FLASH CS3
User Guide
475
5
The data is processed and sent back to the web server.
6
The web server sends the results to the SWF file.
7
The SWF file receives the formatted data.
8
Your ActionScript processes the data so the application can use it.
When you build an application, you must select a protocol for transferring data. The protocol alerts the application
when data is sent or received, in what format the data is transferred, and how it handles a server’s response. After
data is received in the SWF file, it must be manipulated and formatted. If you use a protocol, you do not have to worry
about data being in an unexpected format. When you transfer data using name-value pairs, you can check how the
data is formatted. Check that the data is formatted correctly, so you do not receive XML formatted data and so the
SWF file knows what data to expect and work with.
Collecting and formatting data
Applications depend on user interaction with the SWF file. Frequently, it depends on the user entering data into
forms. Flash provides many ways you can enter and format data in Flash applications. This flexibility exists because
of the capabilities you have with animation and creative control over the interface, and error checking and validation
you can perform using ActionScript.
Benefits from using Flash to build forms to collect data include the following:
•
Increased design control.
•
Decreased or no need for page refreshing.
•
Reuse of common assets.
To save information that you collect from the user, save it in a shared object on the user’s computer. Shared objects
let you store data on a user’s computer, which is similar to using a cookie. For more information on Shared objects,
see the sharedObject class in ActionScript 2.0 Language Reference or ActionScript 3.0 Language and Components
Reference.
Sending and processing data
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.
The following table shows you several options for sending data to a server and receiving data using Flash: