Array Function - MACROMEDIA FLASHLITE2 ACTIONSCRIPT-LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

Array function

Array(): Array Array(numElements:Number): Array Array( [element0:Object [,
element1, element2, ...elementN] ]) : Array
Creates a new array of length zero or more, or an array populated by a list of specified
elements, possibly of different data types.
Lets you create one of the following:
an empty array
an array with a specific length but whose elements have undefined values
an array whose elements have specific values.
Using this function is similar to creating an array with the Array constructor (see
"Constructor for the Array class").
You can pass a number (
types (
element0, element1, ... elementN
Parameters that can accept more than one data type are listed as in the signature as type
.
Object
Availability: ActionScript 1.0; Flash Lite 2.0
Parameters
[optional] - A positive integer that specifies the number of elements in the
numElements
array. You can specify either numElements or the list of elements, not both.
[optional] - one or more parameters,
elementN
the values of which can be of any type. Parameters that can accept more than one data type are
listed as type
Object
Returns
- An array.
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
38
ActionScript language elements
) or a list of elements comprising one or more different
numElements
. You can specify either numElements or the list of elements, not both.
).
element0, element1, ... , elementN
,

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASHLITE2 ACTIONSCRIPT-LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash lite 2

Table of Contents