A-C > Array.length

Array.length

Syntax

myArray.length;

Arguments

None.

Description

Property; contains the length of the array. This property is automatically updated when new elements are added to the array. During assignment myArray[index] = value; if index is a number, and index+1 is a greater than the length property, the length property is updated to index + 1.

Player

Flash 5 or later.

Example

The following code explains how the length property is updated:

//initial length is 0
myArray = new Array();
//myArray.length is updated to 1
myArray[0] = 'a';
//myArray.length is updated to 2
myArray[1] = 'b';
//myArray.length is updated to 10
myArray[9] = 'c';