Array.shift()
Availability
Flash Player 5.
Usage
my_array.shift()
Parameters
None.
Returns
The first element in an array.
Description
Method; removes the first element from an array and returns that element.
Example
The following code creates the array
and assigns it to the variable
var myPets_array = ["cat", "dog", "bird", "fish"];
shifted = myPets_array.shift();
trace(shifted); // returns "cat"
See also
Array.pop()
Array.slice()
Availability
Flash Player 5.
Usage
my_array.slice( [ start [ , end ] ] )
Parameters
A number specifying the index of the starting point for the slice. If
start
number, the starting point begins at the end of the array, where -1 is the last element.
A number specifying the index of the ending point for the slice. If you omit this parameter,
end
the slice includes all elements from the start to the end of the array. If
the ending point is specified from the end of the array, where -1 is the last element.
Returns
An array.
280
Chapter 12: ActionScript Dictionary
and then removes the first element from the array
myPets
.
shifted
is a negative
start
is a negative number,
end
Need help?
Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?
Questions and answers