_global
SWiSH Player Support
SWF6 or later - Supported Internally
Syntax
_global.identifier
Arguments
None.
Returns
A reference to the global object that holds a Variable, String, Object,
Math, and Array.
Description
identifier : creates global variables, objects. Unlike Timelinedeclared
or locally declared variables and functions, global variables and functions are visible to
every Timeline and scope in the SWF file, provided they are not obscured by identifiers with the
same names in inner scopes.
Sample
The following example creates a top-level function, factorial(), that is available to every
Timeline and scope in a SWF file:
_global.factorial = function(n:Number) {
if (n<=1) {
return 1;
} else {
return n*factorial(n-1);
}
};
// Note: factorial 4 == 4*3*2*1 == 24
trace(factorial(4)); // output: 24