[] (array access)
Availability
Flash Player 4.
Usage
myArray = [a0, a1,...aN]
myArray[i] = value
myObject[propertyName]
Parameters
The name of an array.
myArray
a0, a1,...aN
An integer index greater than or equal to 0.
i
The name of an object.
myObject
propertyName
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 (
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
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
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.
Elements in an array; any native type or object instance, including nested arrays.
A string that names a property of the object.
, has three elements; the first is a number and the second two are
employee
with three elements; each element is
ticTacToe
, and so
a0
[] (array access)
57
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers