User Guide
Array.toString() 255
deleteCount An integer that specifies the number of elements to be deleted. This number
includes the element specified in the
start parameter. If no value is specified for deleteCount,
the method deletes all the values from the
start element to the last element in the array. If the
value is 0, no elements are deleted.
value An optional parameter that specifies the values to insert into the array at the insertion
point specified in the
start parameter.
Returns
An array containing the elements that were removed from the original array.
Description
Method; adds and removes elements from an array. This method modifies the array without
making a copy.
Example
The following example creates an array and splices it using element index 1 for the start
parameter. This removes all elements from the array starting with the second element, leaving
only the element at index 0 in the original array:
var myPets_array:Array = new Array("cat", "dog", "bird", "fish");
trace( myPets_array.splice(1) ); // dog,bird,fish
trace( myPets_array ); // cat
The following example creates an array and splices it using element index 1 for the start
parameter and the number 2 for the
deleteCount parameter. This removes two elements from
the array, starting with the second element, leaving the first and last elements in the original array:
var myFlowers_array:Array = new Array("roses", "tulips", "lilies", "orchids");
trace( myFlowers_array.splice(1,2 ) ); // tulips,lilies
trace( myFlowers_array ); // roses,orchids
The following example creates an array and splices it using element index 1 for the start
parameter, the number 0 for the
deleteCount parameter, and the string chair for the value
parameter. This does not remove anything from the original array, and adds the string chair at
index 1:
var myFurniture_array:Array = new Array("couch", "bed", "desk", "lamp");
trace( myFurniture_array.splice(1,0, "chair" ) ); // displays empty array
trace( myFurniture_array ); // displays couch,chair,bed,desk,lamp
Array.toString()
Availability
Flash Player 5.
Usage
my_array.toString() : String