MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 69

Actionscript language reference
Table of Contents

Advertisement

Using HTTP to connect to server-side scripts
The
function and the
getURL()
MovieClip.getURL()
HTTPS protocols. When used as a method of the MovieClip object,
variables of the specified movie clip; each function (or method) handles its response as follows:
The
getURL()
The
loadVariables()
The
loadMovie()
When you use
loadVariables()
several parameters:
is the file in which the remote variables reside.
URL
is the target in the SWF file that receives the variables. (The
Location
not take this parameter.)
sets the HTTP method, either
Variables
or
sends the variables in a separate HTTP header), by which the variables are sent.
POST (
When this parameter is omitted, Flash Player defaults to
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 function call might look like the following example:
loadVariables("http://www.mySite.com/scripts/high_score.cfm", scoreClip, GET);
This example loads variables from the ColdFusion script called
clip instance
scoreClip
Any variables loaded with the
application/x-www-form-urlencoded (a standard format used by CFM and CGI scripts). The file
you specify in the
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 (
separated with a plus (
highScore1=54000&playerName1=RGoulet&highScore2=53455&playerName2=
WNewton&highScore3=42885&playerName3=TJones
Note: You might need to URL-encode certain characters, such as the plus (+) or ampersand (&)
characters. For more information, see
url_encoding.htm.
For more information, see
on page
69.
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 a SWF file and a server.
MovieClip.loadVariables()
methods can communicate with server-side scripts using HTTP or
function returns any information to a browser window, not to Flash Player.
methods loads variables into Flash Player.
methods loads a SWF file into a specified movie clip in Flash Player.
,
getURL()
to load them into the SWF file each time someone played the game.
using the
HTTP method.
GET
loadVariables()
parameter of
URL
loadVariables()
). For example, the following phrase defines several variables:
+
www.macromedia.com/support/flash/ts/documents/
, the
getURL()
Sending and loading variables to and from a remote source
, or
, you can specify
loadMovie()
(appends the variables to the end of the URL)
GET
, but no variables are sent.
GET
high_score.cfm
function must be in the standard MIME format
must write out the variable and value pairs
), and words within a value must be
&
LoadVars class
entry, and
,
MovieClip.loadMovie()
sends all the
getURL()
function does
getURL()
into the movie
"Using the LoadVars class"
loadVariables()
, and
69

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

This manual is also suitable for:

Flex

Table of Contents