_level0.workspace.x0y0 x: 0 y: 0 depth: 2
x: undefined y: undefined depth: 2
_level0.workspace.x0y1 x: 16 y: 0 depth: 3
x: undefined y: undefined depth: 3
_level0.workspace.x0y2 x: 32 y: 0 depth: 4
x: undefined y: undefined depth: 4
_level0.workspace.x0y3 x: 48 y: 0 depth: 5
x: undefined y: undefined depth: 5
etc…
// selectedTile is a global variable
MovieClip.prototype.worktileFunctionality = function(tile:MovieClip) {
drawTerrainTile(this, tile);
this.onPress = function () {
drawTerrainTile(this, selectedTile);
}
}
function setupWorkspace(map:Array, workspace:MovieClip) {
var depth = 1;
for (var i = 0; i < 25; ++i) {
for (var j = 0; j < 25; ++j) {
workspace.createEmptyMovieClip("x"+i+"y"+j, depth);
depth++;
worktile = workspace["x"+i+"y"+j];
worktile._x = j*16;
worktile._y = i*16;
tileNum = map*[j][0]-1;
tile = terrainTiles[tileNum];
trace(worktile+" x: "+worktile._x+" y: "+worktile._y+" depth: "+depth);
// defined
worktile.worktileFunctionality(tile);
trace(worktile+" x: "+worktile._x+" y: "+worktile._y+" depth: "+depth);
// undefined?
}
}
}
What am I doing wrong with this prototype? :h: