Description
Constructor; lets you create an array. You can use the constructor to create different types of
arrays: an empty array, an array with a specific length but whose elements have no values, or an
array whose elements have specific values.
Usage 1: If you don't specify any parameters, an array with a length of 0 is created.
Usage 2: If you specify only a length, an array is created with
no values.
Usage 3: If you use the
specific values.
Example
Usage 1: The following example creates a new Array object with an initial length of 0.
my_array = new Array();
trace(my_array.length); // returns 0
Usage 2: The following example creates a new Array object with an initial length of 4.
my_array = new Array(4);
trace(my_array.length); // returns 4
Usage 3: The following example creates the new Array object
length of 5.
go_gos_array = new Array("Belinda", "Gina", "Kathy", "Charlotte", "Jane");
trace(my_array.length); // returns 5
trace(go_gos_array.join(", ")); // displays elements
The initial elements of the
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
element:
go_gos_array[5] = "Donna";
go_gos_array[1] = "Nina"
trace(go_gos_array.join(" + "));
See also
,
[] (array access)
Array.length
parameters to specify values, an array is created with
element
array are identified as follows:
go_gos
length
go_gos_array
array and changes the second
go_gos_array
number of elements with
, with an initial
Array class
275
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?
Questions and answers