To display all current global variables and their current values:
•
Use the Global object's
For more information on the Message window, see
on page
87.
To clear all current global variables:
•
Use the Global object's
global variables to
To monitor the values of global variables during movie playback, use the Object inspector. For
more information on the Object inspector, see
Global variables in Lingo
In Lingo, variables are considered local by default, and you do not need to precede the variable
name with any keyword. To declare a global variable, you must precede the variable with the
keyword
.
global
If you declare a global variable at the top of a script and before any handlers, the variable is
available to all handlers in that specific script. If you declare a global variable within a handler, the
variable is available only to that handler; however, if you declare a global variable with the same
name within two separate handlers, an update to the variable's value in one handler will also be
reflected in the variable in the other handler.
The following example illustrates working with two global variables:
to all handlers in the script, and
other handlers that declare it on the first line of the handler.
-- Lingo syntax
global gScript -- gScript is available to all handlers
on mouseDown
global gHandler
gScript = 25
gHandler = 30
end
on mouseUp
global gHandler
trace(gHandler) -- displays 30
end
In Lingo, when you use the term
have
as their initial value.
VOID
Global variables in JavaScript syntax
In JavaScript syntax, variables are considered global by default. The scope of a global variable can
be determined by how and where it is declared.
•
If you declare a variable within a JavaScript syntax function without preceding the variable
name with the keyword
script.
•
If you declare a variable outside a JavaScript syntax function, with or without the keyword
the variable is available to all functions within its containing script.
showGlobals()
clearGlobals()
(Lingo) or
VOID
undefined
, which is available within its defining handler and any
gHandler
to define global variables, the variables automatically
global
, the variable is available to all functions within its containing
var
method in the Message window.
"Debugging in the Message window"
method in the Message window to set the value of all
(JavaScript syntax).
"Debugging in the Object inspector" on page
, which is available
gScript
Variables
91.
,
var
23
Need help?
Do you have a question about the DIRECTOR MX 2004-DIRECTOR SCRIPTING and is the answer not in the manual?
Questions and answers