User Guide

208 Chapter 11: Keywords
The term field was used in earlier versions of Director and is maintained for backward
compatibility. For new movies, use
member to refer to field cast members.
Example
This statement places the characters 5 through 10 of the field name entry in the variable
myKeyword:
myKeyword = field("entry").char[5..10]
This statement checks whether the user entered the word desk and, if so, goes to the frame
deskBid:
if member("bid") contains "desk" then _movie.go("deskBid")
See also
char...of, item...of, line...of, word...of
global
Usage
global variable1 {, variable2} {, variable3}...
Description
Keyword; defines a variable as a global variable so that other handlers or movies can share it.
Every handler that examines or changes the content of a global variable must use the
global
keyword to identify the variable as global. Otherwise, the handler treats the variable as a local
variable, even if it is declared to be global in another handler.
Note: To ensure that global variables are available throughout a movie, declare and initialize them in
the
prepareMovie handler. Then, if you leave and return to the movie from another movie, your global
variables will be reset to the initial values unless you first check to see that they aren’t already set.
A global variable can be declared in any handler or script. Its value can be used by any other
handlers or scripts that also declare the variable as global. If the script changes the variables value,
the new value is available to every other handler that treats the variable as global.
A global variable is available in any script or movie, regardless of where it is first declared; it is not
automatically cleared when you navigate to another frame, movie, or window.
Any variables manipulated in the Message window are automatically global, even though they are
not explicitly declared as such.
Movies with Macromedia Shockwave content playing on the Internet cannot access global
variables within other movies, even movies playing on the same HTML page. The only way
movies can share global variables is if an embedded movie navigates to another movie and replaces
itself through either
goToNetMovie or go movie.
Example
The following example sets the global variable StartingPoint to an initial value of 1 if it doesnt
already contain a value. This allows navigation to and from the movie without loss of stored data.
global gStartingPoint
on prepareMovie
if voidP(gStartingPoint) then gStartingPoint = 1
end