The splice( ) method can add elements to, or remove elements from, an array. : Splice : Array Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Array » Splice »

 

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(10"February""March");
        months.splice(52"June");
        months.splice(3)// months is now: ["January", "February", "March"]
                         
        trace(months)//January,February,March

    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Array
» Splice