Arguments
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.
level: An integer specifying the level in the Flash Player to receive the 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.
Returns
Nothing.
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 PHP, or Perl script, and sets the values for variables in a Flash Player level. This Action can also be used to update variables in the active Movie with new values. When you load variables into a level, the Action in the 'Script' Panel in guided mode becomes loadVariablesNum; in expert mode, you must specify loadVariablesNum or choose it from the Add Script Menu. 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:
name=dude&address=home&city=Sydney
When you use the loadVariablesNum Action, you must specify a Flash Player level into which the variables will load.
Sample
The project contains two Dynamic Text elements named date and time.
The onLoad() Event is for the main page.
The referenced URL returns a string
date=dd-mmmm-yyyy&time=hh:mm
The URL is available on our Web site for development / testing purposes.
onLoad () {
date = "date";
time = "time";
loadVariablesNum("http://www.swishzone.com/script_samples/date.php",0,'GET');
}
Note: The above script must be tested using the test in player or test in browser feature. loadVariables / loadMovies functions cannot be debugged using standard debugging features