# Onload jpeg.....arggghh

**URL:** <https://forum.kirupa.com/t/onload-jpeg-arggghh/110621>\
**Category:** Uncategorized\
**Created:** [May 18, 2004, 11:33am UTC](https://forum.kirupa.com/t/onload-jpeg-arggghh/110621 "2004-05-18T11:33:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![albert105](https://avatars.discourse-cdn.com/v4/letter/a/c0e974/32.png) [@albert105](https://forum.kirupa.com/u/albert105)\
**Post date:** [May 18, 2004, 11:33am UTC](https://forum.kirupa.com/t/onload-jpeg-arggghh/110621/1 "2004-05-18T11:33:38Z")

</div>

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
