Global Control Statement
global <variable> [,<variable>, <variable>]...
The global control statement declares one or more variables to be global variables that stay defined when the handlers in which they are used have finished being executed. A global variable can be accessed from across any number of handlers. A local variable becomes undefined when the handler in which it was defined is terminated.
Before using a global variable, a handler must declare the variable using the global keyword. In other words, for global mynumber to work correctly, every handler in which you use it must include a global mynumber statement.
Consider the following handler: on mouseUp
put 1 into mynumber end mouseUp
The variable mynumber will not be retained after the mouseUp subroutine is terminated. If you want to continue using this variable, you must either store it in a field or declare it as a global, as follows:
put 1 into mynumber
Then another handler can use the same variable, as long as it declares mynumber as well:
on mouseDown global mynumber answer mynumber
You can also set a list of global variables to be used simultaneously:
global mynumber1, mynumber2, mynumber3
This text has been mechanically extracted from the Oracle Media Objects 188.8.131.52 MediaTalk Reference, © 1995 Oracle Corporation, and is provided here solely for educational/historical purposes.