K-L > loadVariables

loadVariables

Syntax

loadVariables (url ,location [, variables]);

Arguments

url An absolute or relative URL where the variables are located. The host for the URL must be in the same subdomain as the movie when accessed using a Web browser.

location A level or target to receive the variables. In the Flash Player, movie files are assigned a number according to the order in which they were loaded. The first movie loads into the bottom level (level 0). Inside the loadMovie action, you must specify a level number for each successive movie. This argument is optional.

variables An optional argument specifying a method for sending variables. If there are no variables, omit this argument; otherwise, specify whether to load variables using a GET or POST method. GET appends the variables to the end of the URL and is used for small numbers of variables. POST sends the variables in a separate HTTP header and is used for long strings of variables.

Description

Action; reads data from an external file, such as a text file or text generated by a CGI script, Active Server Pages (ASP), or Personal Home Page (PHP), and sets the values for variables in a movie or 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-urlformencoded (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

Player

Flash 4 or later.

Example

This example loads information from a text file into text fields in the main Timeline (level 0). The variable names of the text fields must match the variable names in the data.txt file.

on(release) {
	loadVariables("data.txt", 0);
}

See also

getURL
MovieClip.loadMovie
MovieClip.loadVariables