MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference page 266

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

Parameters
startIndex:Number
the insertion or deletion begins. You can specify a negative integer to specify a position relative
to the end of the array (for example, -1 is the last element of the array).
deleteCount:Number
deleted. This number includes the element specified in the
is specified for the
deleteCount
element to the last element in the array. If the value is 0, no elements are deleted.
startIndex
[optional] - Specifies the values to insert into the array at the insertion point
value:Object
specified in the
startIndex
Returns
- An array containing the elements that were removed from the original array.
Array
Example
The following example creates an array and splices it by using element index 1 for the
parameter. This removes all elements from the array starting with the second
startIndex
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) ); // Displays dog,bird,fish.
trace( myPets_array ); // cat
The following example creates an array and splices it by using element index 1 for the
parameter and the number 2 for the
startIndex
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 ) ); // Displays tulips,lilies.
trace( myFlowers_array ); // roses,orchids
The following example creates an array and splices it by using element index 1 for the
parameter, the number 0 for the
startIndex
for the
parameter. This does not remove anything from the original array, and adds the
value
string
at index 1:
chair
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
266
ActionScript classes
- An integer that specifies the index of the element in the array where
[optional] - An integer that specifies the number of elements to be
parameter, the method deletes all of the values from the
parameter.
startIndex
parameter. This removes two
deleteCount
parameter, and the string
deleteCount
parameter. If no value
chair

Advertisement

Table of Contents
loading

Table of Contents