gotoAndStop help

Hello, i am new to flash mx 2004, and am stuck on what seems should be straight-forward. I am trying to make a game using tiles, and have a class called buildmap, with the following function

public static function buildGame(map) {
var mapWidth = map[0].length;
var mapHeight = map.length;
for (var i = 0; i<mapHeight; ++i) {
for (var j = 0; j<mapWidth; ++j) {
var name = “t_”+i+"_"+j;
_root.attachMovie(“tile”, name, i100+j2);
_root[name].gotoAndStop((map*[j]+1));
_root[name]._x = (j30);
_root[name]._y = (i
30);
}
}
}

but when i test the movie the gotoAndStop() call does not work and it just plays all the frames in the attached movie.
Any ideas?? :-/