Understanding the ActionScript Language > About built-in objects > Using the Array object |
![]() ![]() ![]() |
Using the Array object
The Array object is a commonly used built-in ActionScript object that stores its data in numbered properties instead of named properties. An array element's name is called an index. Arrays are useful for storing and retrieving certain types of information such as lists of students or a sequence of moves in a game.
You can assign elements of the Array object just as you would assign the property of any object:
move[0] = "a2a4"; move[1] = "h7h5"; move[2] = "b1c3"; ... move[100] = "e3e4";
To access the second element of the above array, use the expression move[2]
.
The Array object has a built-in length
property that is the value of the number of elements in the array. When an element of the Array object is assigned and the element's index is a positive integer such that index >= length
, length
is automatically updated to index + 1
.
For detailed information, see Array (object) in the ActionScript Dictionary.
![]() ![]() ![]() |