Flash Player 6.
Array(): ArrayArray(numElements:Number): ArrayArray( [element0:Object[, element1,element2,...elementN] ]): Array
element One or more elements to place in the array.
An array.
Conversion function; creates a new, empty array or converts specified elements to an array. Using this function is similar to creating an array with the Array constructor (see Constructor for the Array class).
Usage 1: The following example adds items to an array by using the array's index and then by using the Array class's push method:
var myArray:Array = Array(); myArray.push(12); trace(myArray); //traces 12 myArray[4] = 7; trace(myArray); //traces 12,undefined,undefined,undefined,7
Usage 2: The following example creates an array of length 4 but with no elements defined:
var myArray:Array = Array(4); trace(myArray.length); // traces 4 trace(myArray); // traces undefined,undefined,undefined,undefined
Usage 3: The following example creates an array with three defined elements:
var myArray:Array = Array(["firstElement", "secondElement", "thirdElement"]); trace (myArray); // traces firstElement,secondElement,thirdElement
Note: Unlike the Array class constructor, the Array() function does not use the keyword new.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001190.html
Comments
ortho2005 said on Feb 7, 2005 at 9:30 AM : No screen name said on Feb 28, 2005 at 1:20 PM :