|
|
FrozenHaddock Tutorials: Arrays This tutorial bought to you by Foundation-Flash
Hello and welcome. Today we shall be leaning about one concept of Flash, arrays. Arrays are used for storing groups of information.Essentially, an array is a list of items. Those items can be text, or numbers, or decimals, or anything. Arrays in Flash ( like lists) start with bit-of-info number 0. The following example is a simple array of day names. To create an array: var myArr = new Array(); var array_name = new Array(); And then if you wanted to do something or simply to read that item, you would use this: myArr[0] = "Monday"; array_name[number] = something; The number in the square brackets is known as the index. If you do this: var myArr = new Array(); It would workThe array (like a list) would have 25 elements (items on the list) in it - just 0 - 24 would be empty. Loops can easily be integrated with arrays. The only thing you have to know is the length property of the array. You can get the length (or number of items on a list) by: myArr.length For loops are particularly good. This is an example of a message writer: var myArr = new Array(); That concludes this tutorial on arrays, which you will need to use in future. Harry at Foundation-Flash.com
|
|