I am trying to make a Grid that is equal to the width and the height of the flash movie. I have a movieclip called box which is 30x30, and want it to repead along the x to form columns and along the y to form rows so that it makes a big rectangle of smaller squares. For some reason it looks like this:
+
+
+
++++++++++++++
Instead of:
++++++++++++++
++++++++++++++
++++++++++++++
++++++++++++++
Here is my code:
onLoad = function () {
boxWidth = box._width;
stageWidth = Stage.width;
rows = stageWidth/boxWidth;
trace("Number of Rows:");
trace(rows);
//
boxHeight = box._height;
stageHeight = Stage.height;
columns = stageHeight/boxHeight;
trace("Number of Columns:");
trace(columns);
//
boxX = 0;
boxY = 0;
//
for (i=1; i<=columns; i++) {
for (j=1; j<=rows; j++) {
// Create and Orient MovieClips
duplicateMovieClip(box, "boxC"+i+"R"+j, i+j);
//
this["boxC"+i+"R"+j]._x = boxX;
//
this["boxC"+i+"R"+j]._y = boxY;
//
trace("Created Box Number");
trace(i+j);
//
boxX += boxWidth-1;
}
boxY += boxHeight-1;
boxX = 0;
}
};
Any help would be greatly appreciated