SWiSH Player Support
SWF5 or later - Supported Internally
Syntax
arrayName.pop()
Arguments
None.
Returns
Nothing.
Description
Method; removes the last element of an array and returns its value.
Samples
onLoad() {
pets = new Array("fluffy","spot","Mr.Kitty");
trace(pets.pop());
}
// displays 'Mr.Kitty' in the debug window
Since this method actually removes the last element in the array, using it consecutively will produce different results:
onLoad() {
zoners = new Array();
zoners[0] = "David M.";
zoners[1] = "Hugh B.";
zoners[2] = "Roger O.";
zoners[3] = "David P.";
trace("1st: " add zoners.pop());
trace("2nd: " add zoners.pop());
trace("3rd: " add zoners.pop());
}
// The script above will display the following in the debug window:
1st: David P.
2nd: Roger O.
3rd: Hugh B.
See also
Array.shift()