Advertisement |
Creating an Array
There are a number of methods for creating an array. You can use the same instantiation method used for other AS3 classes by using the new keyword with the class name, and have the contents of you array passed as values between the brackets, as shown in the example code below:
var myArray:Array = new Array("Flash", "ActionScript", "Republic of Code");
Alternatively, ActionScript allows you to use a shorter technique by using the square brackets [] to automatically instantiate an array:
var myArray:Array = ["Flash", "ActionScript", "Republic of Code"];
Both of these codes create the same exact thing. Most developers tend to use the shorthand method though.
0 comments: