Cache + Inequal Numbers

Hi everyone …

I’m helping somebody from this forum with a few actionscript problems, but I have run into a problem I can’t figure out and I’m getting tired of trying and having it not working, IE is being retarded again :a:. Here’s the situation: this is a gallery that fades images in and out, and plays a sound when a new image is loaded.

A few vars are loaded dynamically and the fade script and the sound script all work fine, but the problem I’m running into is that the code only loads image1, 3, 5 and 9 of the 10 (this.images is a dynamic loaded var that contains the number of images, 10 in this case). The person I’m working with also reported that everything works fine when viewing a movie for the 2nd and 3d and 4th … time, so I was thinking this has something to do with cache.

Nomatter what I try, it just doesn’t load the equal images ! I’m getting really frustrated by this. Here’s the code. Don’t mind the fade in and out script, the sound script, … , all that works fine. It’s just the images … The most important code is in the first if statement of this.onEnterFrame. That’s where all the changes happen.

If anyone can figure out why, I’d appreciate it :slight_smile:


square._alpha = 0;
mypic = 1;
timer.stop();
autoforward.stop();
pauseframes = 3;
stopped = true;
timeSwitch = 5;
square.loadMovie("http://www.champaigncars.com/slideshow/images/image1.jpg");
square.onEnterFrame = function() {
	if (this.getBytesLoaded() == this.getBytesTotal()) {
		fadeOut = false;
		fadeIn = true;
		_root.lv = new loadVars();
		_root.lv.onLoad = function(success) {
			if (success) {
				loading.htmlText = "";
				jpg = new Array();
				//sounds = new Array();
				for (i=1; i<=this.images; i++) {
					_root.createEmptyMovieClip("sholder"+i, i+20);
					jpg.push("http://www.champaigncars.com/slideshow/images/image"+i+".jpg");
					//sounds.push("http://www.champaigncars.com/slideshow/sounds/sound"+i+".mp3");
					//this["sobject"+i] = new Sound(_root["sholder"+i]);
					//this["sobject"+i].loadSound(sounds[i-1], false);
				}
				_root.sholder1.onEnterFrame = function(){
					if (_root.lv.sobject1.getBytesLoaded() == _root.lv.sobject1.getBytesTotal()){
						_root.lv.sobject1.start(0,1);
						delete this.onEnterFrame
					} else {
						trace(_root.lv.sobject1.getBytesLoaded()/1024+" bytes of "+_root.lv.sobject1.getBytesTotal()/1024+" bytes");
					}
				}
				year.htmlText = this["yeartext"+mypic];
				make.htmlText = this["maketext"+mypic];
				model.htmlText = this["modeltext"+mypic];
				mileage.htmlText = this["mileagetext"+mypic];
				extras.htmlText = this["extrastext"+mypic];
			} else {
				loading.htmlText = "Loading data, please standby ...";
				trace("Failed to load script.");
			}
		};
		_root.lv.load("http://www.champaigncars.com/slideshow/cardetails.txt");
		delete this.onEnterFrame;
	}
};
this.onEnterFrame = function() {
	if (square._alpha<10 && fadeOut) {
		square.loadMovie(jpg[mypic-1]);
		fadeOut = false;
		fadeIn = true;
		year.htmlText = lv["yeartext"+mypic];
		make.htmlText = lv["maketext"+mypic];
		model.htmlText = lv["modeltext"+mypic];
		mileage.htmlText = lv["mileagetext"+mypic];
		extras.htmlText = lv["extrastext"+mypic];
		message.text = mypic;
		_root["sholder"+mypic].onEnterFrame = function() {
			if (lv.sobject[mypic].getBytesLoaded() == lv.sobject[mypic].getBytesTotal()) {
				lv["sobject"+mypic].start(0, 1);
				delete this.onEnterFrame;
			}
		};
	}
	if (square._alpha>10 && fadeOut) {
		square._alpha -= 10;
	}
	if (square._alpha<100 && fadeIn && !fadeOut) {
		square._alpha += 10;
	} else {
		fadeIn = false;
	}
};
next.onRelease = function() {
	!fadeIn && !fadeOut ? lv["sobject"+mypic].stop() : null;
	clearInterval(autoplay);
	timer.gotoAndStop(1);
	autoforward.gotoAndStop(1);
	if (mypic<=lv.images && !fadeIn && !fadeOut) {
		fadeOut = true;
		mypic++;
	}
	if (mypic>lv.images) {
		mypic = 1;
	}
};
back.onRelease = function() {
	!fadeIn && !fadeOut ? lv["sobject"+mypic].stop() : null;
	clearInterval(autoplay);
	timer.gotoAndStop(1);
	autoforward.gotoAndStop(1);
	if (mypic>1 && !fadeIn && !fadeOut) {
		fadeOut = true;
		mypic--;
	}
	if (mypic == 1 && !fadeIn && !fadeOut) {
		fadeOut = true;
		mypic = lv.images;
	}
};
autoforward.onRollOver = function() {
	stopped ? this.gotoAndStop(2) : this.gotoAndStop(2+pauseframes);
};
autoforward.onRollOut = function() {
	stopped ? this.gotoAndStop(1) : this.gotoAndStop(1+pauseframes);
};
autoforward.onPress = function() {
	stopped ? this.gotoAndStop(3) : this.gotoAndStop(3+pauseframes);
};
autoforward.onRelease = function() {
	if (stopped) {
		stopped = false;
		timer.play();
		autoAdvance();
		autoplay = setInterval(autoAdvance, timeSwitch*1000);
	} else {
		stopped = true;
		clearInterval(autoplay);
		timer.gotoAndStop(1);
	}
};
function autoAdvance() {
	!fadeIn && !fadeOut ? lv["sobject"+mypic].stop() : null;
	if (mypic<=lv.images && !fadeIn && !fadeOut) {
		fadeOut = true;
		mypic++;
	}
	if (mypic>lv.images) {
		mypic = 1;
	}
}