256
ActionScript classes
my_array.length = 5;
trace(my_array.length); // my_array.length is updated to 5
trace(my_array); // outputs: a,b,undefined,undefined,undefined
NUMERIC (Array.NUMERIC property)
public static NUMERIC :
Number
Represents numeric sorting instead of string-based sorting. String-based sorting, which is the
default setting, treats numbers as strings when sorting them. For example, string-based sorting
places 10 before 3. A numeric sort treats the elements as numbers so that 3 will be placed
before 10. You can use this constant for the
options
parameter in the
sort()
or
sortOn()
method. The value of this constant is 16.
Availability:
ActionScript 1.0; Flash Lite 2.0
See also
sort (Array.sort method)
,
sortOn (Array.sortOn method)
pop (Array.pop method)
public pop() : Object
Removes the last element from an array and returns the value of that element.
Availability:
ActionScript 1.0; Flash Lite 2.0
Returns
Object
- The value of the last element in the specified array.
Example
The following code creates the array
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
push (Array.push method)
,
shift (Array.shift method)
,
unshift (Array.unshift
method)
Summary of Contents for FLASHLITE2 ACTIONSCRIPT-LANGUAGE
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...