What Is an Array?
The Anatomy of an Array
Creating Arrays
Referencing Array Elements
Determining the Size of an Array
Named Array Elements
Adding Elements to an Array
Removing Elements from an Array
General Array-Manipulation Tools
Multidimensional Arrays
The Multiple-Choice Quiz, Take 3
Onward!
Back in Chapter 3, "Data and Datatypes", we learned that primitive datatypes -- strings, numbers, Booleans, null, and undefined -- represent basic information in our scripts. We also learned that ActionScript supports several composite datatypes, which can group several pieces of data together into a single datum.
The array type is the first composite datatype we'll study. Arrays are used to store and manipulate ordered lists of information and are, therefore, fundamental tools in sequential, repetitive programming. We use them to do everything from storing values retrieved via a user-input form, to generating pull-down menus, to keeping track of enemy spacecraft in a game. In its most basic form, an array is just a list of items, like your grocery list or the entries in your checkbook ledger.
Copyright © 2002 O'Reilly & Associates. All rights reserved.