User Guide
242 Chapter 6: ActionScript Core Classes
Usage 3: The following example creates the new Array object go_gos_array with an initial
length of 5:
var go_gos_array:Array = new Array("Belinda", "Gina", "Kathy", "Charlotte",
"Jane");
trace(go_gos_array.length); // returns 5
trace(go_gos_array.join(", ")); // displays elements
The initial elements of the go_gos_array array are identified, as shown in the following example:
go_gos_array[0] = "Belinda";
go_gos_array[1] = "Gina";
go_gos_array[2] = "Kathy";
go_gos_array[3] = "Charlotte";
go_gos_array[4] = "Jane";
The following code adds a sixth element to the go_gos_array array and changes the second
element:
go_gos_array[5] = "Donna";
go_gos_array[1] = "Nina"
trace(go_gos_array.join(" + "));
// returns Belinda + Nina + Kathy + Charlotte + Jane + Donna
See also
Array.length
, [] (array access)
Array.concat()
Availability
Flash Player 5.
Usage
my_array.concat( [ value0:Object, value1,...valueN ]) : Array
Parameters
value0,...valueN
Numbers, elements, or strings to be concatenated in a new array. If you
don’t pass any values, a duplicate of
my_array is created.
Returns
An array.
Description
Method; concatenates the elements specified in the parameters with the elements in my_array,
and creates a new array. If the
value parameters specify an array, the elements of that array are
concatenated, rather than the array itself. The array
my_array is left unchanged.
Example
The following code concatenates two arrays:
var alpha_array:Array = new Array("a","b","c");
var numeric_array:Array = new Array(1,2,3);