# Photo Gallery using XML and Flash - Thumbnail Bug

**URL:** <https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-thumbnail-bug/178923>\
**Category:** flash\
**Created:** [February 15, 2006, 1:10pm UTC](https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-thumbnail-bug/178923 "2006-02-15T13:10:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Phoenix68](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@Phoenix68](https://forum.kirupa.com/u/Phoenix68)\
**Post date:** [February 15, 2006, 1:10pm UTC](https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-thumbnail-bug/178923/1 "2006-02-15T13:10:02Z")

</div>

Hi,  
i am trying to use the gallery with Thumnails that i found in the tutorial part of the site.  
I made the thumbnails vertical instead of horizontal.  
But i dont think the problem comes from that.

here is the thing:

when loading the thumbnails, if the thumbnails if the thumbnails picture are in diferrent size it messes it al up.

here is the code that i adapted:

///////////////////////////////////////////////////////////////////////////////////////

```auto
function thumbnails_fn(k) { 
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth()); 
tlistener = new Object(); 
tlistener.onLoadInit = function(target_mc) { 
target_mc._y = hit_left._y+(eval("thumbnail_mc.t"+k)._height+5)*k; 
target_mc.pictureValue = k-1; 
target_mc.onRelease = function() { 
p = this.pictureValue; 
nextImage(); 
};

```

///////////////////////////////////////////////////////////////////////////////////////

I think the problem comes from this lign:

```auto
target_mc._y = hit_left._y+(eval("thumbnail_mc.t"+k)._height+5)*k

```

actually it places the movie according its own size assuming that all the previous movies in the loop where the same size. but they aren’t

I been trying to make it work for so long but i can t find a way to go around it

i hope someone will be able to help me  
thanx

here is the link to the demo  
[http://phoenix68.9online.fr/daeja2.swf](http://phoenix68.9online.fr/daeja2.swf)  
as you can see the two last thumbnails assume than the 8 before them where the same size as they are …☹

---

<div class="post-metadata">

**Author:** ![isca](https://avatars.discourse-cdn.com/v4/letter/i/ebca7d/32.png) [@isca](https://forum.kirupa.com/u/isca)\
**Post date:** [March 19, 2006, 11:52am UTC](https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-thumbnail-bug/178923/2 "2006-03-19T11:52:04Z")

</div>

:\*(

I’ve done the same tutorial and already modified some things, the scroller is now vertical and some other stuff…  
But i also have the problem that the thumbs are not positioned correctly when i use different imagesizes.  
I have tried the 2 daeja-files but it isn’t working, even if i change the mentioned line 110, the thumbs are still messed up…(all load on the same position)

another problem is the scroller. If you move the mousecursor over the “scroll-area” but haven’t moved the cursor over a thumbnail the scroller wont work

here you can look at the swf:  
[http://noiserus.de/st-test/test/xml\_photogallery\_user.swf](http://noiserus.de/st-test/test/xml_photogallery_user.swf)

here is the fla:  
[http://noiserus.de/st-test/test/xml\_photogallery\_user.fla](http://noiserus.de/st-test/test/xml_photogallery_user.fla)

thx in advance…

---

<div class="post-metadata">

**Author:** ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)\
**Post date:** [March 19, 2006, 12:32pm UTC](https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-thumbnail-bug/178923/3 "2006-03-19T12:32:36Z")

</div>

In your fla is still the ‘old’ code, you should load the thumbs in a sequence

```auto
function thumbnails_fn() {
	//clear the interval
	clearInterval(thumbdelay);
	thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
	//define the previous thumb
	var prevThumb = this["thumbnail_mc"+(k-1)];
	tlistener = new Object();
	tlistener.onLoadInit = function(target_mc) {
		//set the y position
		if (k>0) {
			target_mc._y = prevThumb._y+prevThumb._height+5;
		} else {
			target_mc._y = hitleft._y;
		}
		target_mc.pictureValue = k-1;
		target_mc.onRelease = function() {
			p = this.pictureValue;
			nextImage();
		};
		target_mc.onRollOver = function() {
			this._alpha = 50;
			thumbNailScroller();
		};
		target_mc.onRollOut = function() {
			this._alpha = 100;
		};
		//call function nextThumb
		nextThumb();
	};
	image_mcl = new MovieClipLoader();
	image_mcl.addListener(tlistener);
	image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
function nextThumb() {
	k<total-1 ? (k++, thumbnails_fn()) : null;
}

```

scotty(-:

---

<div class="post-metadata">

**Author:** ![isca](https://avatars.discourse-cdn.com/v4/letter/i/ebca7d/32.png) [@isca](https://forum.kirupa.com/u/isca)\
**Post date:** [March 19, 2006, 12:51pm UTC](https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-thumbnail-bug/178923/4 "2006-03-19T12:51:38Z")

</div>

thx for the fast reply…

but it doesn’t work…

when i paste the code in daeja2.fla the thumbs are still on the same place.

but i’m currently trying something different:

```auto
function thumbnails_fn(k) {
	thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
	tlistener = new Object();
	tlistener.onLoadInit = function(target_mc) {
		var help = ("thumbnail_mc.t"+k);
		var help2:Number = ;
		trace(help2);
		trace(help);
		target_mc._y = hit_left._y+(75+10)*k;
		target_mc.pictureValue = k;

```

i want to get the height of the movieclip carrying the thumb.  
with the var ‘help’ i’m getting the current mc,  
with the var ‘help2’ i want to get the height of that clip, but i’m not sure how to do it… what do i have to write there?  
when i got it i just exchange “75” (in “target\_mc.\_y = hit\_left.\_y+(75+10)\*k;”)and “help2”.

good idea???

edit:  
uuups,  
i need to get the height of the previous thumb so i would rather try  
var help = (“thumbnail\_mc.t”+(k-1));

then

var help = (“thumbnail\_mc.t”+k);

---

<div class="post-metadata">

**Author:** ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)\
**Post date:** [March 19, 2006, 1:27pm UTC](https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-thumbnail-bug/178923/5 "2006-03-19T13:27:44Z")

</div>

In my code, change

```auto
var prevThumb = this["thumbnail_mc"+(k-1)];

```

in

```auto
var prevThumb = thumbnail_mc["t"+(k-1)];

```

scotty(-:

---

<div class="post-metadata">

**Author:** ![isca](https://avatars.discourse-cdn.com/v4/letter/i/ebca7d/32.png) [@isca](https://forum.kirupa.com/u/isca)\
**Post date:** [March 19, 2006, 1:38pm UTC](https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-thumbnail-bug/178923/6 "2006-03-19T13:38:17Z")

</div>

yeeeeeaaaaaaaaah, you’re the man…

that worked…now it is functioning properly…:thumb2:

---

<div class="post-metadata">

**Author:** ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)\
**Post date:** [March 19, 2006, 2:35pm UTC](https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-thumbnail-bug/178923/7 "2006-03-19T14:35:41Z")

</div>

no problem =)
