var gamestage = this;
var tilex = 608;
var tiley = -280;
var tempx = 0;
var tempy = 0;
var tileCoorX = new Array();
var tileCoorY = new Array();
var xx = 0;
var yy = 0;
tileOnDown = function (e) {
//tells us the tile clicked on.
}
//generate tiles
for (xx = 0; xx < 40; xx++) {
tempx = tilex;
tempy = tiley;
for (yy = 0; yy < 40; yy++) {
//adding a bitmap from the library
var tile = new lib.theGraphic();
tile.x = tempx;
tile.y = tempy;
gamestage.addChild(tile);
//tile.addEventListener("click", tileOnDown);
//also tried
tile.on("click", tileOnDown);
tempx -= 32;
tempy += 16;
}
tilex += 32;
tiley += 16;
}