![]()  | 
| Advertisement | 
Misc Array Methods and Properties
In the final section of the tutorial we will just explain a number of methods and properties which do not add or remove anything from an array, but which could still come handy.
- You can retrieve the number of items within an array by using the .length property. This property is helpful when you want to automate the processing of an array:
 
var myArray:Array = ["Flash", "ActionScript", "Republic of Code"];
trace(myArray.length);
trace(myArray.length);
Testing this code should output the following: 3.
- If for some reason you want to reverse the order of items in your array, you can do that by simply using the reverse() method:
 
var myArray:Array = ["Flash", "ActionScript", "Republic of Code"];
myArray.reverse();
trace(myArray);
myArray.reverse();
trace(myArray);
Testing this code should output the following: "Republic of Code,ActionScript,Flash".
These were some of the most commonly used methods for working with arrays. You can check the ActionScript Reference to learn about the other less popular methods.

.png)
0 comments: