User Guide

46 ActionScript language elements
Parameters
numElements:Number [optional] - A positive integer that specifies the number of elements in
the array. You can specify either
numElements or the list of elements, but not both.
elementN:Object [optional] - One or more parameters, element0, element1, ... ,
elementN
, the values of which can be of any type. Parameters that can accept more than one
data type are listed as type
Object. You can specify either numElements or the list of
elements, but not both.
Returns
Array - An array.
Example
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
Unlike the Array class constructor, the Array() function does not use the
keyword new .
See also
Array
asfunction protocol
asfunction:function:Function, parameter:String
A special protocol for URLs in HTML text fields that allows an HREF link to call an
ActionScript function. In HTML text fields, you can create links using the HTML
A tag. The
HREF attribute of the
A tag contains a URL that uses a standard protocol such as HTTP,
HTTPS, or FTP. The
asfunction protocol is an additional protocol that is specific to Flash,
which causes the link to invoke an ActionScript function.
Availability: ActionScript 1.0; Flash Player 5