Flash ActionScript Tutorial: Array at First Glance
This Flash ActionScript tutorial series show how to use Array with ActionScript 3. The first three tutorials show how to create new Arrays and how to assign values to Arrays with different methods. The fouth to sixth tutorials show how to access or retrieve values from Arrays. The last tutorial show how to load an external text file to Array and how to manipulate the Array.
Flash Tutorial Content:
While a single variable holds a single value, Array can hold a list of values. This Flash ActionScript tutorial show show how to create a new Array with ActionScript..
Flash ActionScript Codes:
//Create an empty Array with the name trayArray
//The size of this Array is 5
//Actually you may imagine an Array like a DIY ice cube tray
//The number of cavity (elements) decide the size of the ice cube tray
//Each cavity of the ice cube tray can contain or hold a thing (value)
var trayArray:Array = new Array(5);
//Although the Array was created, we did not assign values to any
//elements up to now.
//Check the size of testArray
//AS use length to define the size of an array
//The size of this Array is trayArray.length
//For easier memory, you can also imagine:
//If the length is longer, there are more cavities (elements)
//If the length is shorter, there are less cavities (elements)
output_txt.text = "The number of elements of trayArray are: " + trayArray.length;
Download Flash Source File:
This Flash ActionScript tutorial shows how to create a new Array.