Design Lab 5: Game Media   [ Monday 6pm - Rm 908]

instructor: Jonah Warren
email: jonah AT feedtank DOT com
url: http://www.playfulsystems.com/teaching/2006/gamemedia


2D Arrays
[ Download the FLA ]

The following program has the following structure:

stop();

var posArray:Array = new Array();
var posCount:Number = 0;

// creating a 2d Array
for(var xpos=0;xpos<6;xpos++) {
	var column = new Array();
	for(var ypos=0;ypos<6;ypos++) {
		column[ypos] = xpos + "," + ypos;
		posCount++;
	}
	posArray.push(column);
}

// printing it out
textfld = "";
for(var ypos=0;ypos<6;ypos++) {
	for(var xpos=0;xpos<6;xpos++) {
		textfld += new String(posArray[xpos][ypos]) + " ";
	}
	textfld += "\n";
}


This program will print out the following: