[flash8] Looping through dataset records attaching movieclips

Hi everybody !!

I have this problem:

I am using an XML connector and a dataset to pick records from an XML file. I then loop througt the dataset, attaching a movieclip for every record in a container movieclip. This works fine, i am using the following AS in the container movieclip:

**//goto last data set record

function addMovieClips(i) {
while (_root.data_ds.hasPrevious()) {
this.attachMovie(“targetClip”, “record”+i, this.getNextHighestDepth(), _root.data_ds.currentItem);
this[“record”+i]._x = this[“record”+i]._x+(i*90);

data_ds is the instance name of my dataset, targetClip is the linkage name of the movieclip i attach for each record in the dataset.

This works fine, but the script attaches the movieclips in a long row, spacing 90 pixels on the x axis between every attached movieclip. What i would like to do, is for the AS to make a new row, say every 4 attached movieclips (90 pixels below the row above) so you get several rows with 4 movieclips in every row inside the container movieclip. I have fooled around with this for some time now and can´t get it to work fine.

You can see a working example here:


I need to do this in order to create an image gallery with thumbnails. I suppose this is no match for someone experienced in AS, for that reason i would be grateful for help in this matter.

Thank You in advance for Your help !!