Hey,
Okay. I have two loops, which attachs a bunch of MCs to another MC on the stage. On each of the MCs that get attached, I want to have an onRelease callback, where it should pass j, i, and rnd. Code:
for (i=0; i<boardH; i++) {
for (j=0; j<boardW; j++) {
rnd = Math.floor(Math.random() * tileNum) + 1;
board*[j] = rnd;
name = "t" + i + "_" + j;
map.attachMovie("tiles", name, i+j*100);
map[name]._x = j * tileW + (spacing * j);
map[name]._y = i * tileH + (spacing * i);
map[name].gotoAndStop(board*[j]);
map[name].onRelease = checkPos;
}
}
The problem… how can I pass three arguments (j, i, and rnd) to the callback onRelease?
I tried the following callback:
map[name].onRelease = function() {checkPos(j, i, rnd);};
However, this passes the last number that j, i, and rnd was… It doesn’t pass the j, i, and rnd for that specific MC…
I hope I made myself clear.
EDIT:
I fixed it!
Heres the code I changed/added:
map[name].i = i;
map[name].j = j;
map[name].rnd = rnd;
map[name].onRelease = function(){checkPos(this.j, this.i, this.rnd);};
Thank you,
Jamison