cjl wrote:[color=blue]
> OK:
>
> I am really scratching my head over a preload / image swapping problem,
> so I started conducting experiments:
>
>
http://www.saintrays.net/experiment1.html
>
http://www.saintrays.net/experiment2.html
>
http://www.saintrays.net/experiment3.html[/color]
[...]
[color=blue]
> The problem is that for casespace.net image swapping is not smooth in
> IE, and it seems to recheck with the website each time I swap an image,
> even though they are preloaded, greatly slowing down the ability to
> quickly scroll through images. It works flawlessly in Firefox.[/color]
Your casespace.net site did not work at all for me in either IE or Firefox.
[color=blue]
>
> I can't find the difference between experiment3 (which works in IE
> without the constant checking) and the method I use on casespace.
>
> Any help would be appreciated. I am going nuts. Arrrgh.
>[/color]
You script seemed overly complex to me - here's an alternative that
seems to work fine for me:
<script type="text/javascript">
var PicObj = {
loaded : 0,
showing : 0,
pics : [],
imgEl : null
};
function loader(numToLoad){
PicObj.imgEl = document.getElementById('the_image');
for (var i=0; i<numToLoad; ++i) {
PicObj.pics[i] = new Image();
PicObj.pics[i].src = 'mr0_' + i + '.jpg';
}
PicObj.loaded = --i;
PicObj.pics[PicObj.loaded].onload = looper;
}
function looper() {
PicObj.imgEl.src = PicObj.pics[PicObj.showing].src;
PicObj.showing = ++PicObj.showing % PicObj.loaded;
timeout_state = setTimeout("looper()", 50);
}
window.onload = function(){loader(26);}
</script>
--
Rob