Operators > [] (array access operator)

[] (array access operator)

Syntax

myArray["a0", "a1",..."aN"];
object[value1, value2, ...valueN];

Arguments

myArray The name of an array.

a0, a1,...aN Elements in an array.

value1, 2,...N Names of properties.

Description

Operator; creates a new object initializing the properties specified in the arguments, or initializes new array with the elements (a0) specified in the arguments.

The created object has the generic Object object as its prototype. Using this operator is the same as calling new Object and populating the properties using the assignment operator. Using this operator is an alternative to using the new operator, which allows for the quick and convenient creation of objects.

Player

Flash 4 or later.

Example

The following example code samples are two different ways of creating a new empty Array object:

myArray =[];
myArray = new Array();

The following is an example of a simple array:

myArray = ["red", "orange", "yellow", "green", "blue", "purple"]
myArray[0]="red"
myArray[1]="yellow"
myArray[2]="green"
myArray[3]="blue"
myArray[4]="purple"