Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > Array > unshift (Array.unshift method) | |||
public unshift(value:Object) : Number
Adds one or more elements to the beginning of an array and returns the new length of the array.
Availability: ActionScript 1.0; Flash Player 5
value:Object - One or more numbers, elements, or variables to be inserted at the beginning of the array.
Number - An integer representing the new length of the array.
The following example shows the use of the Array.unshift() method:
var pets_array:Array = new Array("dog", "cat", "fish");
trace( pets_array ); // Displays dog,cat,fish.
pets_array.unshift("ferrets", "gophers", "engineers");
trace( pets_array ); // Displays ferrets,gophers,engineers,dog,cat,fish.
pop (Array.pop method), push (Array.push method), shift (Array.shift method)
Version 8
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00001920.html