Multiple rows (Image gallery)

Hello Everyone. What I would like to have is multiple rows of thumbnails with the following gallery. Right now it only puts them in a straight line but I’d like to have it so after 5 thumbnails are loaded, a new row of thumbnails is started. I don’t know enough actionscript to do this myself.


myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
    //portfolioTag = this.firstChild;
    numimages = this.firstChild.childNodes.length;
    spacing = 100;
    for (i=0; i<numimages; i++) {
        this.picHolder = this.firstChild.childNodes*;
        this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
        this.thumbHolder._x = i*spacing;
        this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
        this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
        this.thumbHolder.title = this.picHolder.attributes.title;
        this.thumbHolder.main = this.picHolder.attributes.main;
        this.thumbHolder.onRelease = function() {
            loader.loadMovie(this.main);
            title_txt.text = this.title;
        };
    }
};
myPhoto.load("xmlphoto.xml");

If someone can tell me what I would need to do to correct this code or can actually take the time to correct it for me, I’d very much appreciate it. Thank you.

Example of what I want:

x x x x x
x x x x x
x x x x x

Each x = a thumbnail