User Guide
346 Chapter 12: Methods
Example
This statement displays in the message window the current status of a download begun with
getNetText() and the resulting net ID placed in the variable netID:
put getStreamStatus(netID)
-- [#URL: "www.macromedia.com", #state: "InProgress", #bytesSoFar: 250, \
#bytesTotal: 50000, #error: EMPTY]
See also
on streamStatus, tellStreamStatus()
getVariable()
Usage
-- Lingo syntax
spriteObjRef.getVariable(variableName {, returnValueOrReference})
// JavaScript syntax
spriteObjRef.getVariable(variableName {, returnValueOrReference});
Description
Function; returns the current value of the given variable from the specified Flash sprite. Flash
variables were introduced in Flash version 4.
This function can be used in two ways.
Setting the optional
returnValueOrReference parameter to TRUE (the default) returns the
current value of the variable as a string. Setting the
returnValueOrReference parameter to
FALSE returns the current literal value of the Flash variable.
If the value of the Flash variable is an object reference, you must set the
returnValueOrReference parameter to FALSE in order for the returned value to have meaning
as an object reference. If it is returned as a string, the string will not be a valid object reference.
Parameters
variableName
Required. Specifies the name of the variable whose value is returned.
returnValueOrReference Optional. Specifies whether the returned value is a string (TRUE) or as
an object reference (
FALSE).
Example
This statement sets the variable tValue to the string value of the Flash variable named gOtherVar
in the Flash movie in sprite 3:
-- Lingo syntax
tValue = sprite(3).getVariable("gOtherVar", TRUE)
put(tValue) -- "5"
// JavaScript syntax
var tValue = sprite(3).getVariable("gOtherVar", true);
trace(tValue); // 5