<classwork>

Array

Sometimes you will have a bunch of variables with a lot in common, such as:

name1="John";
name2="Vanessa";
name3="Jennifer";
name4="Frank";

You can store a set of variables in a container called an array.

people=new Array();
people=new Array("John","Vanessa","Jennifer","Frank");

Then, to access the information in an array, you need to reference an array index number.

people[0]
//returns the value "John"

message="Hello "+people[0] +".";
//returns the value "Hello John."

You can even replace the values later, removing the old value.
people[3]="Nicole";
//replaces "Jennifer"


download the array sample file (file name: array.fla)
right click on the file (control-click for Mac) and select to download to your drive.