Onload jpeg.....arggghh

Hi,
I have the following problem:

I dynamically load jpegs (small thumbs) in my flash movie.
Every thumb has a border and it places the jpeg inside that
border. I reuse all the borders and make them visible or
invisible when it has a jpeg or not.

Now, I have to change the position of these jpegs because
they have different sizes.
My problem is that this positioning isn’t working well…
Sometimes it’s working fine but sometimes it’s not so I guess
that’s because sometimes it hasn’t loaded the jpegs before
he runs the position script.

I don’t need a slick preloader; just a script that preloads
the jpegs and THEN set the position of the images.

This is my code (that is NOT working):

[COLOR=Teal]
this.holder.thumb.loadMovie(thumbURL);

this.onEnterFrame = function() {
this.holder.thumb.onLoad = function() {

//set the position
holderCenterX=24;
holderCenterY=24;
thumbCenterX=this.holder.thumb._width/2;
thumbCenterY=this.holder.thumb._height/2;
this.holder.thumb._x=holderCenterX-thumbCenterX;
this.holder.thumb._y=holderCenterY-thumbCenterY;
delete this.onEnterFrame;
};
};
[/COLOR]

Can anyone give me an example, because I know have to use
onLoad or onData… but I don’t know HOW the code actual
looks like.

thanks