User Guide

Array.push() 245
my_array[9] = 'c';
trace(my_array.length); // my_array.length is updated to 10
trace(my_array);
// displays:
// a,b,undefined,undefined,undefined,undefined,undefined,undefined,undefined,c
// if the length property is now set to 5, the array will be truncated
my_array.length = 5;
trace(my_array.length); // my_array.length is updated to 5
trace(my_array); // outputs: a,b,undefined,undefined,undefined
Array.pop()
Availability
Flash Player 5.
Usage
my_array.pop() : Object
Parameters
None.
Returns
The value of the last element in the specified array.
Description
Method; removes the last element from an array and returns the value of that element.
Example
The following code creates the myPets_array array containing four elements, and then removes
its last element:
var myPets_array:Array = new Array("cat", "dog", "bird", "fish");
var popped:Object = myPets_array.pop();
trace(popped); // displays fish
trace(myPets_array); // displays cat,dog,bird
See Also
Array.push()
, Array.shift(), Array.unshift()
Array.push()
Availability
Flash Player 5.
Usage
my_array.push(value,...) : Number
Parameters
value
One or more values to append to the array.