Name

loadVariables( ) Global Function — retrieve an external set of variables

Availability

Flash 4 and later

Synopsis

loadVariables(URL, target)
loadVariables(URL, target, method)

Arguments

URL

A string specifying the path to a variable source—either a server-side script that returns variables or a text file containing variables.

target

A string indicating the path to the movie clip or document level on which the loaded variables will be defined. May also be a reference to a movie clip or document level (references are converted to paths when used in a string context).

method

An optional string indicating the method by which to send variables to an external script. If specified, the variables from the current timeline are sent to the script and target receives the loaded variables. If omitted, variables are retrieved but none are sent. The legal values for method are "GET" and "POST". This parameter must be a literal, not a variable or other expression. The standalone version of the Flash Player always uses the "GET" method regardless of the method specified.

Description

Normally, we define variables inside our movies using ActionScript. However, using loadVariables( ), we may also import variables into a movie from a text file or a server-side application such as a Perl script. Variables loaded via loadVariables( ) are scoped to the movie clip or level specified by target and are always of the string datatype. To attach loaded variables to the current timeline, use the empty string as the ...

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.