User Guide

[] (array access) 57
[] (array access)
Availability
Flash Player 4.
Usage
myArray = [a0, a1,...aN]
myArray[i] = value
myObject[propertyName]
Parameters
myArray
The name of an array.
a0, a1,...aN Elements in an array; any native type or object instance, including nested arrays.
i An integer index greater than or equal to 0.
myObject The name of an object.
propertyName A string that names a property of the object.
Returns
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).
Description
Operator; initializes a new array or multidimensional array with the specified elements (a0, and so
on), or accesses elements in an array. The array access operator lets you dynamically set and
retrieve instance, variable, and object names. It also lets you access object properties.
Usage 1: An array is an object whose properties are called elements, which are each identified by a
number called an index. When you create an array, you surround the elements with the array
access ([]) operator (or brackets). An array can contain elements of various types. For example, the
following array, called
employee, has three elements; the first is a number and the second two are
strings (inside quotation marks):
var employee:Array = [15, "Barbara", "Jay"];
You can nest brackets to simulate multidimensional arrays. You can nest arrays up to 256 levels
deep. The following code creates an array called
ticTacToe with three elements; each element is
also an array with three elements:
var ticTacToe:Array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
// Select Debug > List Variables in test mode
// to see a list of the array elements.