[Flash 8 AS 2.0] Help in code that generate grid view of box using for loop

Dear all,

I am trying to use for loop to load small grey box to display in the image below.

But i couldn’t figure out how to put in the if else condition when the col hits 7 and bring it to the next row.

Below is my if else code:

container1 = new Array();
container1 = this.firstChild.childNodes; //drawing info from xml file
spacing = 13;
for (i=0; i<container1.length; i++) {
this.thumbHolder = thumbnails.createEmptyMovieClip(“thumbnail”+i, i);
if (i<7) {
this.thumbHolder._x = i*spacing;
this.thumbHolder._y = 0;
} else {
this.thumbHolder._x = (i-7)*spacing;
this.thumbHolder._y = Number(thumbHolder._y)*7;
}
}

Your help will be appreciated.

Thanks in advance.

Regards,
Wai