The splice( ) method can add elements to, or remove elements from, an array.
theArray.splice(startIndex, deleteCount, item1, item2,...itemn)
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var months:Array = new Array("January", "Friday",
"April", "May", "Sunday", "Monday", "July");
months.splice(1,1);
months.splice(1, 0, "February", "March");
months.splice(5, 2, "June");
months.splice(3); // months is now: ["January", "February", "March"]
trace(months); //January,February,March
}
}
}
Related examples in the same category