Hey everybody, I’m having some function problems that I can’t figure out how to solve. I have a movieClip (instance name “playingsquare”) and when I press a button a grid is supposed to be formed made of duplicates of playingsquare. To do this I have two functions. When the button is pressed it calls the “makestandardboard” function. The makestandardboard function calls the “makearow” function several times. The makearow function contains a while loop which duplicates the MC playing square across the screen. The problem is that the only duplicate movieClips that show up on the screen are those from the last row created. Here is the code.
Button is pressed
on (release) {
j = 0;
x = 0;
makestandardboard();
}
makestandardboard
function makestandardboard () {
makearow(32, 245, 85);
makearow(48, 165, 95);
makearow(56, 125, 105);
}
makearow
function makearow (rowlength, xvalue, yvalue) {
x = 0;
for(i=0; i<rowlength; i++) {
_root.playingsquare.duplicateMovieClip(“playingsquare”+j+i, i);
_root[“playingsquare”+j+i]._visible = true;
_root[“playingsquare”+j+i]._x = xvalue+x;
_root[“playingsquare”+j+i]._y = yvalue;
x += 10;
}
j++;
}
With this code, only the last row, makearow(56,125,105), is the only one that will be visible. If I create another row after that, the new one will be the last row. I even made an array of all the squares that were being created to make sure the last row wasn’t the only one being created and found I was right. All the squares are being made but only the last row is showing up. Any help would be greatly appreciated.
Thanks,
-Steve