My jpg preloader problems

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 :slight_smile:

Thanks in advance


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;
  		}
	}

}