Usage 3: The following example creates the new Array object
with an initial
go_gos_array
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
array are identified, as shown in the following example:
go_gos_array
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
array and changes the second
go_gos_array
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 class
105
Need help?
Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?