sets the HTTP method, either
Variables
URL) or
sends the variables in a separate HTTP header), by which the variables
POST (
are sent. When this parameter is omitted, Flash Player defaults to
are sent.
For example, if you want to track the high scores for a game, you could store the scores on a
server and use
loadVariables()
the game. The function call might look like the following example:
this.createEmptyMovieClip("highscore_mc", 10);
loadVariables("http://www.helpexamples.com/flash/highscore.php",
highscore_mc, "GET");
This example loads variables from the ColdFusion script called high_score.cfm into the movie
clip instance
scoreClip
Any variables loaded with the
format application/x-www-form-urlencoded (a standard format used by CFM and CGI scripts).
The file you specify in the
and value pairs in this format so that Flash can read them. This file can specify any number of
variables; variable and value pairs must be separated with an ampersand (
a value must be separated with a plus (
several variables:
highScore1=54000&playerName1=RGoulet&highScore2=53455&playerName2=
WNewton&highScore3=42885&playerName3=TJones
You might need to URL-encode certain characters, such as the plus (+) sign or
ampersand (&) characters. For more information, see
tn_14143.
For more information, see the following topic:
see loadVariables function, getURL function, loadMovie function, and the
LoadVars entry in the ActionScript 2.0 Language Reference.
Using the LoadVars class
If you are publishing to Flash Player 6 or later and want more flexibility than
offers, you can use the LoadVars class instead to transfer variables between
loadVariables()
a SWF file and a server.
The LoadVars class was introduced in Flash Player 6 to provide a cleaner, more object-
oriented interface for the common task of exchanging CGI data with a web server. Advantages
of the LoadVars class include the following:
to load them into the SWF file each time someone played
using the
HTTP method.
GET
loadVariables()
parameter of
URL
loadVariables()
) sign. For example, the following phrase defines
+
(appends the variables to the end of the
GET
function must be in the standard MIME
must write out the variable
www.macromedia.com/go/
"Using the LoadVars class" on page
Using HTTP to connect to server-side scripts
, but no variables
GET
), and words within
&
639. Also,
639
Need help?
Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?