# My jpg preloader problems

**URL:** <https://forum.kirupa.com/t/my-jpg-preloader-problems/40698>\
**Category:** Uncategorized\
**Created:** [January 21, 2004, 4:45am UTC](https://forum.kirupa.com/t/my-jpg-preloader-problems/40698 "2004-01-21T04:45:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mindfriction](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mindfriction/32/172_2.png) [@mindfriction](https://forum.kirupa.com/u/mindfriction)\
**Post date:** [January 21, 2004, 4:45am UTC](https://forum.kirupa.com/t/my-jpg-preloader-problems/40698/1 "2004-01-21T04:45:42Z")

</div>

Hi guys, Ive read the thousands of preloader threads, its just im using some of my preloader code from a preloader tjhat I know works ! It just doesnt seem to work with lloading JPG’s… Can someone look over my code please 🙂

Thanks in advance

```auto

loadImg = function (curr_thumb, img_url, i){
	curr_loader = curr_thumb.attachMovie("imgLoader_mc","loader"+i+"_mc",i);
	curr_thumb.thumbTarget_mc.loadMovie(img_url);
	curr_loader.onEnterFrame=function(){
		trace("curr_loader onEnterFrame");
		totalBytes = Math.round(curr_thumb.thumbTarget_mc.getBytesTotal()/1000);
		receivedBytes = Math.round(curr_thumb.thumbTarget_mc.getBytesLoaded()/1000);
		trace("totalBytes: " + totalBytes);
		trace("recievedBytes: " + receivedBytes);
		percentage = (receivedBytes/totalBytes)*100;
  		if (receivedBytes >= totalBytes){
    		//delete this.onEnterFrame;
			trace("finished loading");
			curr_loader.removeMovieClip();
			delete this.onEnterFrame;
  		}
  		else {
			curr_loader.imgLoaderBar_mc._xscale = percentage;
  		}
	}

}

```
