MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference page 121

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

var my_array:Array = new Array();
my_array[0] = 15;
my_array[1] = "Hello";
my_array[2] = true;
You can use brackets ([]) to add a fourth element, as shown in the following example:
my_array[3] = "George";
You can use brackets ([]) to access an element in a multidimensional array. The first set of
brackets identifies the element in the original array, and the second set identifies the element
in the nested array. The following lines of code send the number 6 to the Output panel.
var ticTacToe:Array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
trace(ticTacToe[1][2]);// output: 6
Usage 3: You can use the array access ([]) operator instead of the
dynamically set and retrieve values for movie clip names or any property of an object. The
following line of code sends the number 6 to the Output panel.
name["mc" + i] = "left_corner";
Availability: ActionScript 1.0; Flash Lite 2.0
Operands
-
myArray :
Object
a0, a1,...aN :
Object
instance, including nested arrays.
-
An integer index greater than or equal to 0.
i :
Number
i
myObject :
Object
propertyName :
String
Returns
-
Object
Usage 1: A reference to an array.
Usage 2: A value from the array; either a native type or an object instance (including an Array
instance).
Usage 3: A property from the object; either a native type or an object instance (including an
Array instance).
The name of an array.
myArray
-
a0,a1,...aN
-
The name of an object.
myObject
-
propertyName
Elements in an array; any native type or object
A string that names a property of the object.
function to
eval()
Operators
121

Advertisement

Table of Contents
loading

Table of Contents