EasyManua.ls Logo

MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT - Syntax

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...
Syntax 29
Target paths are hierarchical addresses of movie clip instance names, variables, and objects in a
SWF file. You name a movie clip instance in the movie clip Property inspector. (The main
Timeline always has the name
_root.) You can use a target path to direct an action at a movie clip
or to get or set the value of a variable. For example, the following statement is the target path to
the variable
volume inside the movie clip stereoControl:
_root.stereoControl.volume
For more information on target paths, see “Absolute and relative target paths” in Using Flash
Help.
Variables are identifiers that hold values of any data type. Variables can be created, changed, and
updated. The values they store can be retrieved for use in scripts. In the following example, the
identifiers on the left side of the equal signs are variables:
var x = 5;
var name = "Lolo";
var c_color = new Color(mcinstanceName);
For more information on variables, see About variables” on page 40.
Syntax
As with any language, ActionScript has syntax rules that you must follow in order to create scripts
that can compile and run correctly. This section describes the elements that comprise
ActionScript syntax.
Case sensitivity
In a case-sensitive programming language, variable names that differ only in case (
book and Book)
are considered different from each other. Therefore, its good practice to follow consistent
capitalization conventions, such as those used in this manual, to make it easy to identify names of
functions and variables in ActionScript code.
When you publish files for Flash Player 7 or later, Flash implements case sensitivity whether you
are using ActionScript 1 or ActionScript 2.0. This means that keywords, class names, variables,
method names, and so on are all case sensitive. For example:
// In file targeting Flash Player 7
// and either ActionScript 1 or ActionScript 2.0
//
// Sets properties of two different objects
cat.hilite = true;
CAT.hilite = true;
// Creates three different variables
var myVar=10;
var myvar=10;
var mYvAr=10;
// Does not generate an error
var array = new Array();
var date = new Date();
This change also affects external variables loaded with LoadVars.load().

Table of Contents

Related product manuals