# Grid

**URL:** <https://forum.kirupa.com/t/grid/104268>\
**Category:** Uncategorized\
**Created:** [March 14, 2004, 6:04am UTC](https://forum.kirupa.com/t/grid/104268 "2004-03-14T06:04:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yeldarb](https://avatars.discourse-cdn.com/v4/letter/y/51bf81/32.png) [@Yeldarb](https://forum.kirupa.com/u/Yeldarb)\
**Post date:** [March 14, 2004, 6:04am UTC](https://forum.kirupa.com/t/grid/104268/1 "2004-03-14T06:04:03Z")

</div>

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:

```auto

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 🙂
