# Jpeg preloading & Cache

**URL:** <https://forum.kirupa.com/t/jpeg-preloading-cache/105325>\
**Category:** Uncategorized\
**Created:** [March 25, 2004, 2:36am UTC](https://forum.kirupa.com/t/jpeg-preloading-cache/105325 "2004-03-25T02:36:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![quik](https://avatars.discourse-cdn.com/v4/letter/q/e19b73/32.png) [@quik](https://forum.kirupa.com/u/quik)\
**Post date:** [March 25, 2004, 2:36am UTC](https://forum.kirupa.com/t/jpeg-preloading-cache/105325/1 "2004-03-25T02:36:40Z")

</div>

Sorry, I put this in the wrong forum initally!!

I have a load bar which is part of the site design, therefore it is showing all the time.

I have a slideshow style section using jpegs, they change images every 5 seconds.

I want the preloader bar (which is operating through colin mooks’ better preloading api) to stay on 100% IF the jpeg has already been cached, I tried setting a timer but its not doing it for me.

Basically it still shows the preloader going from 0 then directly to 100% width when the image is cached.

It works while the image is loading however.

Any ideas?

The function that I’ve written to load the objects then fires it off to the class written by mr moock.

Code below.

```auto

loadPhotos = function (where, what) {
	trace("WHERE: "+where+" 
FILENAME: "+what);
	where._alpha = 0;
	pauseLength = 50;
	bar_mc._xscale = 100;
	_root.onEnterFrame = function(){		
		if(pauseLength <0){
			bar_mc.onLoadProgress = function(loaderObj) {
				if(loaderObj.getPercent()<99){
					trace("load percent: "+loaderObj.getPercent());
					this._xscale = loaderObj.getPercent();
				}else{
					this._xscale = 100;
					delete _root.enterFrame;
					break;
				}
			};
		}else{
			pauseLength--;
			trace(pauseLength);
		}
	};
	myLoader = new com.qlod.LoaderClass();
	myListener_obj = new Object();
	myListener_obj.onLoadComplete = function(success, loaderObj) {
		bar_mc._xscale = 100;
		where.fadeIn(99, 2);
		_root.img_holder._alpha = 99;
		_root.or_trans.fadeIn(20, 2);
	};
	myLoader.addListener(bar_mc);
	myLoader.load(""+where+"", ""+what+"", myListener_obj);
};

```
