# Photo gallery using grid

**URL:** <https://forum.kirupa.com/t/photo-gallery-using-grid/206469>\
**Category:** flash\
**Created:** [November 8, 2006, 2:09pm UTC](https://forum.kirupa.com/t/photo-gallery-using-grid/206469 "2006-11-08T14:09:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hema77](https://avatars.discourse-cdn.com/v4/letter/h/49beb7/32.png) [@hema77](https://forum.kirupa.com/u/hema77)\
**Post date:** [November 8, 2006, 2:09pm UTC](https://forum.kirupa.com/t/photo-gallery-using-grid/206469/1 "2006-11-08T14:09:01Z")

</div>

Hi!.. I am using the following code to create a photo gallery with thumbnails… however, I need a grid system cause all the photos do not fit in a horizontal or vertical line. I have searched the forum but since I don’t have much clue of actionscript I don’t know how to fit the script here… can anyone help me? Thanks.

myPhoto = new XML();  
myPhoto.ignoreWhite = true;  
myPhoto.onLoad = function(success) {  
//portfolioTag = this.firstChild;  
numimages = this.firstChild.childNodes.length;  
spacing = 70;  
for (i=0; i\<numimages; i++) {  
this.picHolder = this.firstChild.childNodes\*;  
this.thumbHolder = thumbnails.createEmptyMovieClip(“thumbnail”+i, i);  
this.thumbHolder.\_y = 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”);
