Name

loadVariablesNum( ) Global Function — attach an external set of variables to a document level

Availability

Flash 5. Use the Load Variables Action in Flash 4 to place variables on a document level.

Synopsis

loadVariablesNum(URL, level)
loadVariablesNum(URL, level, 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.

level

A non-negative integer, or an expression that yields one, indicating the document level on which the loaded variables will be defined.

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 level receives the loaded variables. If omitted, variables are retrieved but none are loaded. 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

The loadVariablesNum( ) function is nearly identical to loadVariables( ) except that it requires the target level to be specified as a number rather than as a string. This means that loadVariablesNum( ) can attach variables to document levels only, not movie clips. The target level can be specified dynamically, as in:

var myLevel = 2;
loadVariablesNum("myVars.txt", myLevel);

A similar effect could be achieved using string concatenation ...

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.