You create multidimensional arrays in ActionScript by constructing an array, the elements of
which are also arrays. To access elements of a multidimensional array, you can nest the array access
operator with itself, as shown in the following example:
var chessboard = new Array();
for (var i=0; i<8; i++) {
chessboard.push(new Array(8));
}
function getContentsOfSquare(row, column){
chessboard[row][column];
}
You can check for matching
on page
66.
Specifying an object's path
To use an action to control a movie clip or loaded SWF file, you must specify its name and its
address, called a target path.
In ActionScript, you identify a movie clip by its instance name. For example, in the following
statement, the
_alpha
star._alpha = 50;
To give a movie clip an instance name:
Select the movie clip on the Stage.
1
Enter an instance name in the Property inspector.
2
To identify a loaded SWF file:
•
Use
, where
_levelX
SWF file.
For example, a SWF file loaded into level 5 has the target path
example, a SWF file is loaded into level 5 and its visibility is set to
onClipEvent(load) {
loadMovieNum("myMovie.swf", 5);
}
onClipEvent(enterFrame) {
_level5._visible = false;
}
To enter a SWF file's target path:
•
In the Actions panel (Window > Development > Actions), click the Insert Target Path button
and select a movie clip from the list that appears.
For more information on target paths, see "Absolute and relative target paths" in Using
Flash Help.
50
Chapter 2: ActionScript Basics
operators in your scripts; see
[]
property of the movie clip named
is the level number specified in the
X
"Checking syntax and punctuation"
is set to 50% visibility:
star
action that loaded the
loadMovie()
. In the following
_level5
:
false
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?