[Flash CS3] Help getting XML Photo gallery to adapt to different thumbnail size

NOTE: This is all done using** AS2**

So after studying the wonderful tutorial on how to use XML to make a photo gallery, I made one. And it loads and everything :slight_smile: The problem comes in when I try and load thumbnails that consist of landscape AND portrait (tall) orientation.

The thumbnails will sometimes overlap. I can increase the space between the thumbnails, but it looks a little wonky when I do that (LARGE gaps sometimes between pictures).

Any idea on how to programatically have Flash find the width of each thumbnail loaded and space the next one based on that amount?

Here’s my code:

function photoLoader() {
	var Album = photos_xml.firstChild.childNodes;
	for (i=0; i< Album.length; i++) { //This cycles through the XML document picture nodes
		var currentPic = Album*;
		var currentThumb_mc = thumb_viewer.createEmptyMovieClip("thumbnail_mc"+i, i);//Tells our thumnail viewer to create an empty movie clip
		currentThumb_mc._y = i * thumb_spacing;
		currentThumb_mc.createEmptyMovieClip("thumb_container", 0);//That empty movie clip we made creates its on clip inside itself to hold the thumbnail
		currentThumb_mc.thumb_container.loadMovie(currentPic.attributes.thumb);//This loads the thumbnail in our inner clip
		trace(currentThumb_mc.thumb_container._height);
		//This creates the variables "title" and "image" to store the title and image info from the XML file for each thumbnail
		currentThumb_mc.title = currentPic.attributes.title;
		currentThumb_mc.image = currentPic.attributes.image;
		var blanky:String = "";
		
		currentThumb_mc.onRollOver = cuurentThumb_mc.onDragOver = function() {
			photo_caption.text = this.title;
			this._alpha = 50;
			thumbScroller();
			
		}
		
		currentThumb_mc.onRollOut = currentThumb_mc.onDragOut = function() {
			photo_caption.text = blanky;
			this._alpha = 100;
		}
		
		currentThumb_mc.onRelease = function() {
			photo_viewer.load(this.image);
			progBar._visible = true;
		}
		
		
		
	}
}

The variable thumb_spacing is defined outside of the function earlier and is set to 60.

I apologize if there’s a BUNCH of comments throughout - I tend to forget stuff easily, so it helps when I come back to stuff and its labeled :angel: