
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 variable’s 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 doesn’t
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
Содержание DIRECTOR MX 2004-DIRECTOR SCRIPTING
Страница 1: ...DIRECTOR MX 2004 Director Scripting Reference...
Страница 48: ...48 Chapter 2 Director Scripting Essentials...
Страница 100: ...100 Chapter 4 Debugging Scripts in Director...
Страница 118: ...118 Chapter 5 Director Core Objects...
Страница 594: ...594 Chapter 12 Methods...
Страница 684: ...684 Chapter 14 Properties See also DVD...
Страница 702: ...702 Chapter 14 Properties See also face vertices vertices flat...
Страница 856: ...856 Chapter 14 Properties JavaScript syntax sprite 15 member member 3 4...
Страница 889: ...netPresent 889 _player alert Sorry the Network Support Xtras could not be found See also Player...
Страница 1102: ...1102 Chapter 14 Properties...