# Using different sized thumbnails in gallery tut

**URL:** https://forum.kirupa.com/t/using-different-sized-thumbnails-in-gallery-tut/153271
**Category:** Uncategorized
**Created:** [June 30, 2005, 10:57am UTC](https://forum.kirupa.com/t/using-different-sized-thumbnails-in-gallery-tut/153271 "2005-06-30T10:57:54Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mleavi01](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mleavi01/32/1433_2.png) [@mleavi01](https://forum.kirupa.com/u/mleavi01)
#### Post date: [June 30, 2005, 10:57am UTC](https://forum.kirupa.com/t/using-different-sized-thumbnails-in-gallery-tut/153271/1 "2005-06-30T10:57:54Z")

</div>

hi,

i am creating an adaptation of the [xml gallery with thumbnails tutorial](http://kirupa.com/developer/mx2004/thumbnails.htm) from this site, but i want to use vertical and horizontal images, with the same height, but varying widths as thumbnails. the code from the tutorial uses  
the movie clip loader class with this code:

```auto

function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip("t"+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = hit_left._x+(target_mc._width+5)*k;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = this.pictureValue-1;
nextImage();
};
target_mc.onRollOver = function() {
this._alpha = 50;
thumbNailScroller();
};
target_mc.onRollOut = function() {
this._alpha = 100;
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}

```

the x location of each new thumbnail\_mc.t[k] is determined by this line:

```auto

target_mc._x = hit_left._x+(target_mc._width+5)*k;

```

problem is that in order for the spacing to be right all of the thumbnails have to be the same width. what i want to do is have the new thumbnails\_mc.t[k] x value equal the x value of the previous thumbnail\_mc.t[k] plus the width of the previous thumbnail\_mc.t[k] plus 5 px.

So my question is how do I code that?

I’ve tried to create a variable by placing this in the onLoadInit function, but it comes back undefined.

```auto

var ptx = thumbnail_mc.t[k-1]._x;
var ptw = thumbnail_mc.t[k-1]._width;

```

i’m just not sure how to get the x value and width of the previously loaded thumbnail. if i had that i could easily keep the spacing right. Any help would be greatly appreciated.

m
