User Guide
124 Chapter 2: ActionScript Language Reference
Array.unshift()
Availability
Flash Player 5.
Usage
my_array.unshift(value1:Object,value2,...valueN) : Number
Parameters
value1,...valueN
One or more numbers, elements, or variables to be inserted at the
beginning of the array.
Returns
An integer representing the new length of the array.
Description
Method; adds one or more elements to the beginning of an array and returns the array’s
new length.
Example
The following example shows the use of Array.unshift():
var pets_array:Array = new Array("dog", "cat", "fish");
trace( pets_array ); // dog,cat,fish
pets_array.unshift("ferrets", "gophers", "engineers");
trace( pets_array ); // ferrets,gophers,engineers,dog,cat,fish