Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > Array > shift (Array.shift method) | |||
public shift() : Object
Removes the first element from an array and returns that element.
Availability: ActionScript 1.0; Flash Player 5
Object - The first element in an array.
The following code creates the array myPets_array and then removes the first element from the array and assigns it to the variable shifted:
var myPets_array:Array = new Array("cat", "dog", "bird", "fish");
var shifted:Object = myPets_array.shift();
trace(shifted); // Displays "cat".
trace(myPets_array); // Displays dog,bird,fish.
pop (Array.pop method), push (Array.push method), unshift (Array.unshift 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/00001913.html