EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Page 606

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT
816 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
606 Chapter 12: ActionScript Dictionary
Example
The following example uses the return action inside the body of the sum() function to return
the added value of the three parameters. The next line of code calls
sum() and assigns the
returned value to the variable
newValue.
function sum(a, b, c){
return a + b + c;
}
newValue = sum(4, 32, 78);
trace(newValue);
// sends 114 to the Output panel
See also
function
_root
Availability
Flash Player 5.
Usage
_root.movieClip
_root.action
_root.property
Parameters
movieClip
The instance name of a movie clip.
action An action or method.
property A property of the MovieClip object.
Description
Property; specifies or returns a reference to the root movie Timeline. If a movie has multiple
levels, the root movie Timeline is on the level containing the currently executing script. For
example, if a script in level 1 evaluates
_root, _level1 is returned.
Specifying
_root is the same as using the slash notation (/) to specify an absolute path within the
current level.
Note: If a movie that contains _root is loaded into another movie, _root refers to the Timeline of the
loading movie, not to the Timeline that contains
_root. If you want to ensure that _root refers to the
Timeline of the loaded movie even if it is loaded into another movie, use
MovieClip._lockroot.
Example
The following example stops the Timeline of the level containing the currently executing script:
_root.stop();
The following example sends the Timeline in the current level to Frame 3:
_root.gotoAndStop(3);
See also
MovieClip._lockroot
, _parent, targetPath

Table of Contents

Related product manuals