# Thumbnails in a grid

**URL:** https://forum.kirupa.com/t/thumbnails-in-a-grid/164127
**Category:** flash
**Created:** [September 28, 2005, 6:21pm UTC](https://forum.kirupa.com/t/thumbnails-in-a-grid/164127 "2005-09-28T18:21:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ben\_is\_sparky](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ben_is_sparky/32/664_2.png) [@ben\_is\_sparky](https://forum.kirupa.com/u/ben_is_sparky)
#### Post date: [September 28, 2005, 6:21pm UTC](https://forum.kirupa.com/t/thumbnails-in-a-grid/164127/1 "2005-09-28T18:21:51Z")

</div>

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:

```auto
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
loadMovie(pictureThumbPath,"thumbContainer"+currentPicture);
//Duplicate the movieClip so that it's ready for tyhe next picture. Then set it's position
duplicateMovieClip("thumbContainer"+currentPicture,"thumbContainer"+nextPicture,nextPicture);

setProperty("thumbContainer"+nextPicture,_x,(spacing+pictureWidth)*nextPicture+spacing);

}

```

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?
