loadVariablesNum( ) Global Function | Flash 5 |
attach an external set of variables to a document level |
A string specifying the path to a variable source—either a server-side script that returns variables or a text file containing variables.
A nonnegative integer, or an expression that yields one, indicating the number of the document level on which the loaded variables will be defined.
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. On Windows, prior to Flash 6, the Standalone Player always used the "GET" method, regardless of the method specified. As of Flash 6, both "GET" and "POST" are supported. See Appendix F.
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 can be achieved using string concatenation with the regular loadVariables( ) function:
loadVariables("myVars.txt", "_level" + myLevel);