MACROMEDIA FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH Manual page 172

Learning actionscript 2.0 in flash
Table of Contents

Advertisement

4.
Select Control > Test Movie to view the elements that are displayed in the Output panel.
You will see the following in the Output panel:
[0][0]
[0][1]
[0][2]
[1][0]
[1][1]
[1][2]
[2][0]
[2][1]
[2][2]
For information on using arrays, see
elements, see
"About adding and removing elements" on page
array access operator, see
Creating associative arrays
An associative array, which is like an object, is made of unordered keys and values. Associative
arrays use keys instead of a numeric index to organize stored values. Each key is a unique
string, and it is associated with and used to access one value. That value can be a data type
such as Number, Array, Object, and so on. When you create code to find a value that's
associated with a key, you are indexing or performing a lookup. This is what you will probably
use associative arrays for most often.
The association between a key and value is commonly referred to as its binding; the key and
value are mapped to each other. For example, a contact book might be considered an
associative array, where the names are the keys and email addresses are the values
Associative arrays are unordered collections of key and value pairs. Your code should
not expect the keys of an associative array to be in a specific order.
When you use associative arrays, you can call the array element you need using a string rather
than a number, which is often easier to remember. The downside is that these arrays aren't as
useful in a loop because they do not use numbers as the index value. They are useful when you
need to look up by key values frequently. For example, if you had an array of names and ages
that you needed to refer to a lot, you might use an associative array.
The following example demonstrates how to create an object and define a series of properties
in an associative array.
To create a simple associative array:
1.
Create a new Flash document.
172
Syntax and Language Fundamentals
"Using arrays" on page
"Using dot and array access operators" on page
164. For information on array
168. For information on the
184.

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents