
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, it’s 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()
.
Содержание FLASH MX 2004 - ACTIONSCRIPT
Страница 1: ...ActionScript Reference Guide...
Страница 8: ...8 Contents...
Страница 12: ......
Страница 24: ...24 Chapter 1 What s New in Flash MX 2004 ActionScript...
Страница 54: ...54 Chapter 2 ActionScript Basics...
Страница 80: ...80 Chapter 3 Writing and Debugging Scripts...
Страница 82: ......
Страница 110: ...110 Chapter 5 Creating Interaction with ActionScript...
Страница 112: ......
Страница 120: ...120 Chapter 6 Using the Built In Classes...
Страница 176: ......
Страница 192: ...192 Chapter 10 Working with External Data...
Страница 202: ...202 Chapter 11 Working with External Media...
Страница 204: ......
Страница 782: ...782 Chapter 12 ActionScript Dictionary...
Страница 793: ...Other keys 793 221 222 Key Key code...
Страница 794: ...794 Appendix C Keyboard Keys and Key Code Values...
Страница 798: ...798 Appendix D Writing Scripts for Earlier Versions of Flash Player...
Страница 806: ...806 Appendix E Object Oriented Programming with ActionScript 1...
Страница 816: ...816 Index...