[flash 8] loading thumbnails

hello. i´ve recently used to the “Adding Thumbnails” tutorial to build a photo gallery (I am just starting with actionscript and it was a great tutorial - thanks!). I made 2 simple changes, 1 - the thumbnail scroller was vertical, 2 - I wanted to be able to load thumbnails which were different heights (but the same width).

It worked… almost. The problem is that usually the first time the page loads the thumbnails overlap in a funny way. however if i simply referesh my browser then everything gets placed in the right position! I assume this means that my code is more or less correct but somehow i am somehow asking for information about the thumbnails (such the height of a thumbnail) before the thumbnail has been loaded.

how do i fix this? The relevant code is below, and you can view this poorly behaved photogallery here: http://fakingbrave.com/art.htm

Thanks!
Brook

function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip(“t”+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
thumb_y_total=0;
for (j=0;j<k;j++){
thumb_y_total = thumb_y_total + eval(“thumbnail_mc.t”+j)._height+3
};
target_mc._y = thumb_y_total;
target_mc.pictureValue = k;
target_mc.onRelease = function() {
p = k-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);
}