# Dynamic Boxes problem

**URL:** <https://forum.kirupa.com/t/dynamic-boxes-problem/243971>\
**Category:** flash\
**Created:** [November 13, 2007, 4:51am UTC](https://forum.kirupa.com/t/dynamic-boxes-problem/243971 "2007-11-13T04:51:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![imvain2](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/imvain2/32/620_2.png) [@imvain2](https://forum.kirupa.com/u/imvain2)\
**Post date:** [November 13, 2007, 4:51am UTC](https://forum.kirupa.com/t/dynamic-boxes-problem/243971/1 "2007-11-13T04:51:42Z")

</div>

I have two movieclips on \_root, one is colorbox and the other is boxoff.

My goal is two create an 8 x 8 grid, with both boxoff and colorbox.

I need colorbox to sit behind the boxoff boxes. So that boxoff is clickable.

I’m having a few problems, first there is no box being shown at position 0, and the second is I can’t get boxoff to display above colorbox.

```auto

xgridlines = 9;
ygridlines = 9;
distance = 35;
totalboxes = xgridlines * ygridlines;
setProperty ("boxoff", _visible, false);

k = 0;
for (j=1; j<=xgridlines-1; j++) {
	for (i=1; i<=ygridlines-1; i++) {
		duplicateMovieClip ("boxoff", "boxoff"+k, k);
		duplicateMovieClip ("colorbox", "colorbox"+k, _root.getNextHighestDepth());
		setProperty ("colorbox"+k, _x, distance*i);
		setProperty ("colorbox"+k, _y, distance*j);
		setProperty ("boxoff"+k, _x, distance*i);
		setProperty ("boxoff"+k, _y, distance*j);
		this["color_"+k] = new Color("colorbox"+k);
		iColor = "0xFF0000";
		eval("color_"+k).setRGB(iColor);
		k++;
	}
}

for(var i=0;i<totalboxes;i++){
	_root.attachMovie("boxoff", "boxoff"+i, i);
	_root["boxoff"+i].onRelease = function(){
		trace(this._name);
		//this.removeMovieClip();
	};
}

```
