Thumbnails in a grid

I’m doing a grid of thumbnails, loaded from an xml file. So far I’ve got them in a straight line, weith this code:

numPictures = _root.picturesXML.firstChild.childNodes.length
picturesPerRow = 7
spacing = 16.25
pictureHeight = 60
pictureWidth = 80
startHeight = 110

//Create an array for each piece of info.
titlesArray = new Array();
descriptionsArray = new Array();
pathArray = new Array();
thumbPathArray = new Array();

for(currentPicture = 0; currentPicture<numPictures; currentPicture++){
//Get the current picture details into some variables
pictureTitle = _root.picturesXML.firstChild.childNodes[currentPicture].childNodes[0].firstChild
pictureDescription = _root.picturesXML.firstChild.childNodes[currentPicture].childNodes[1].firstChild
picturePath = _root.picturesXML.firstChild.childNodes[currentPicture].childNodes[2].firstChild
pictureThumbPath = _root.picturesXML.firstChild.childNodes[currentPicture].childNodes[3].firstChild

nextPicture = currentPicture+1
//Load the picture into the movieclip
//Duplicate the movieClip so that it's ready for tyhe next picture. Then set it's position



How would I get it to create a new line when the pictures gets to any multiple of picturesPerRow?

Also, can the scrollbar component be used to scroll down the page of thumbnails? Would I need to put them all inside another movieclip to do this? If it can’t what would be the best way of scrolling them?