Hi fellows,
I found a preloader tutorial for preloading external SWF files at runtime. I “abused” it for loading JPGs, which should be no problem (using Flash MX). This works on my PC in Netscape 4.7 & 6.2, on Mac in Netscape 4.7 & 6.2 and IE 5, but NOT on (my) PC in IE 6. (Flash 6 player installed & checked)
You can watch and compare it in different browsers by yourself: http://www.empty-v.net/test2/sequence.html
What this film does (at least on Netscape): two JPGs are loaded at runtime, one after one. Progress is shown by a bar on top. When done loading the pictures the root-movie advances to frame 2 and shows “feddisch” (german slang for “done”).
Problem: On IE 6 the first picture shows up after a while, no progress has been shown before. The second picture won’t be seen until you press the relaod button like mad. The “done”-message isn’t displayed (I guess the film never reaches frame 2).
Should be no caching error, emptied every cache, even created new names for fresh loading.
You can see the original film (without the “done”-message) on http://www.actionscript.org/showMovie.php?id=355
This one works loaded from the original page, but shows the same strange behaviour when installed on my page. (Even tried another provider, same thing).
For better survey see the used code:
For the first (and originally only) frame:
// Feb 6th, 2002
// Sequential Preloader BETA 2 by Jesse Stratford
// www.actionscript.org, [email][email protected][/email]
// --------------------------
// initialize counter variables
count = 0;
// how many movies are we going to be loading?
numMoviesToLoad = 2;
// define our loadNext function
function loadNext () {
// we're no longer preloading the last movie
_root["loadcontainer"+count] = false;
// send the percent bar back to it's first frame (0%)
_root.bar.gotoAndStop(1);
// if there are still movies which need loading
if (count<numMoviesToLoad) {
// incriment counter
trace ("here count");
count++;
// instance name for the next container MC
var newName = "container"+count;
// duplicate the container MC
_root.container.duplicateMovieClip(newName, count);
// this is my debugging code
with (this[newName]) {
_x = random(150);
_y = random(150);
_xscale = random(100);
_yscale = random(100);
_alpha = 50;
}
// end debugging
// load the next movie in the sequence into the new container
loadMovie ("bild"+count+"b.jpg", _root[newName]);
// we are now preloading a new movie, set the var to True
_root["load"+newName] = true;
}
}
loadNext();
and for the new created MC-Container
onClipEvent (enterFrame) {
// if this movie needs preloading
if (_root["load"+this._name]) {
// has the loadMovie command been processed yet?
if (total_bytes == null) {
total_bytes = this.getBytesTotal();
} else {
// controll bar - standard % preloader code
loaded_bytes = this.getBytesLoaded();
remaining_bytes = total_bytes-loaded_bytes;
percent_done = int((loaded_bytes/total_bytes)*100);
_root.bar.gotoAndStop(percent_done);
// if loading is complete
if (percent_done == 100) {
trace ("fully loaded");
// not loading this one any more, load the next
_root["load"+this._name] = false;
_root.loadNext();
}
}
}
}
First I hope you can see the same error with that version on my page (empty-v), so I’m not alone. Second I hope you have some useful tips for a workaround.
Some comments:
I need to load JPGs, not SWFs. This will be for dynamic loading of ~1500 JPGs on a photographer’s site. These JPGs are subject to change, and I don’t want to create an extra SWF for each JPG.
Maybe this has something to do with timeouts? Why does this only happen in IE 6, and why not in the original movie?
Thanx for any comment or tip!