Flash Player 4.
loadVariables (
"url
" ,"
target
"[
,
variables
])
url
An absolute or relative URL where the variables are located. If you access the movie using a web browser, the host for the URL must be in the same subdomain as the movie itself.
target
The target path to a movie clip that receives the loaded variables.
variables
An optional parameter specifying an HTTP method for sending variables. The parameter must be the string GET
or POST
. If there are no variables to be sent, omit this parameter. The GET
method appends the variables to the end of the URL and is used for small numbers of variables. The POST
method sends the variables in a separate HTTP header and is used for long strings of variables.
Nothing.
Action; reads data from an external file, such as a text file or text generated by a CGI script, Active Server Pages (ASP), or PHP, or Perl script, and sets the values for variables in a Flash Player level or a target movie clip. This action can also be used to update variables in the active movie with new values.
The text at the specified URL must be in the standard MIME format application/x-www-form-urlencoded (a standard format used by CGI scripts). The movie and the variables to be loaded must reside at the same subdomain. Any number of variables can be specified. For example, the phrase below defines several variables:
company=Macromedia&address=600+Townsend&city=San+Francisco&zip=94103
The first movie to open in an instance of the Flash Player loads into the bottom level (identified in code as _level0
). When you use loadMovie() or loadMovieNum() to load subsequent movies into the Flash Player, you must assign a level number in the Flash Player or a target movie clip into which each movie will load. When you use the loadVariables
action, you must specify a target MovieClip into which the variables will load.
If you want to load variables into a specific level, use loadVariablesNum() instead of loadVariables()
.
This example loads information from a text file into text fields into the varTarget
movie clip on the main Timeline. The variable names of the text fields must match the variable names in the data.txt file.
on(release) { loadVariables("data.txt", "_root.varTarget"); }
loadVariablesNum()
, loadMovie()
, loadMovieNum()
, getURL
, MovieClip.loadMovie()
,
MovieClip.loadVariables()