Mega Code Archive

 
Categories / Flash ActionScript / Array
 

Adding New Elements with the length Variable

package{   import flash.display.Sprite;      public class Main extends Sprite{     public function Main(){         var colors = ["green", "red", "blue"];                  colors.length = 50;                  trace(colors); // green,red,blue,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,     }   } }