Removing Elements with the length Variable : Length : Array Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Array » Length »

 

Removing Elements with the length Variable


 

To delete elements from the end of the array: set the array's length variable to a number smaller than the current length:


package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){


        var toppings:Array = ["p""t""c""g""b"];
        toppings.length = 3;
        trace(toppings);  //p,t,c
    }
  }
}

        



Leave a Comment / Note


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


Flash / Flex / ActionScript examples

 Navioo Array
» Length