Hi,

The problem is a little hard to explain. Look at what you're doing for each clip. You're basically sending the same commands to every single clip, so they all end up in the same place. You have to use the indexing number i. Here's how it works.

code:

function createTemplates():Void {

//Define the grid width (in number of cells);

var width:Number = 4;

//Define the item spacing;

var spacing:Number = 50;

for (i=0; i<totalProducts; i++) {

var attachProduct:MovieClip = attachMovie("templateClip", "product"+i, i);

/*Ok, we want to use the index i. For the first four elements, we want to

have a _y value of 0. For the next four, we want a _y value of 50. For the

next four, _y = 100. So the formula will be (How many times 4 divides into

i) * 50. To find out how many times a number divides into another number,

we simply divide by the number and take the floor.*/

attachProduct._y = Math.floor(i / width) * spacing;

/*Now for the x values, we want to find out the remainder thats left after

we divide by four, and then multiply this by 50. So for instance item 5 should

have an _x value of 50. The reamainder of 5 after dividing by 4 is 1. 1 * 50 = 50.

This works for any number. Luckily, Flash has a handy operator for working

out the remainder, and its the modulo operator %*/

attachProduct._x = (i % width) * spacing;

//That should do it!

}

}

Hope this helps.