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
Summary of Contents for DIRECTOR MX 2004-DIRECTOR SCRIPTING
Page 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Page 48: ...48 Chapter 2 Director Scripting Essentials...
Page 100: ...100 Chapter 4 Debugging Scripts in Director...
Page 118: ...118 Chapter 5 Director Core Objects...
Page 594: ...594 Chapter 12 Methods...
Page 684: ...684 Chapter 14 Properties See also DVD...
Page 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Page 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Page 1102: ...1102 Chapter 14 Properties...