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

instructor: Jonah Warren
email: jonah AT feedtank DOT com
url: http://www.playfulsystems.com/teaching/2007/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:uint=0;xpos<6;xpos++) {
	var column = new Array();
	for(var ypos:uint=0;ypos<6;ypos++) {
		column[ypos] = xpos + "," + ypos;
		posCount++;
	}
	posArray.push(column);
}

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


This program will print out the following: