396 Chapter 12: ActionScript Dictionary
Description
Identifier; creates global variables, objects, or classes. For example, you could create a library that
is exposed as a global ActionScript object, much like the Math or Date object. Unlike Timeline-
declared 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.
Example
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) {
if (n <= 1) {
return 1;
} else {
return n * factorial(n-1);
}
}
See also
var, set variable
gotoAndPlay()
Availability
Flash 2.
Usage
gotoAndPlay([scene,] frame)
Parameters
scene
An optional string specifying the name of the scene to which the playhead is sent.
frame A number representing the frame number, or a string representing the label of the frame,
to which the playhead is sent.
Returns
Nothing.
Description
Function; sends the playhead to the specified frame in a scene and plays from that frame. If no
scene is specified, the playhead goes to the specified frame in the current scene.
Example
When the user clicks a button to which gotoAndPlay() is assigned, the playhead is sent to
Frame 16 in the current scene and starts to play.
on(release) {
gotoAndPlay(16);
}
See also
MovieClip.gotoAndPlay()