Mr J
06-03-2004, 02:58 PM
I have written an Image Preloader script which consists of two functions.
Function one is called and preloads the first image, when the image has loaded a second function is called to check for more images in the array, if there is another image then function one is called to preload it.
This is the basic cycle of the script and have implemented this in some scripts where I need to prevent functions from being run until all necessary images have been preloaded.
Everything works fine but....
In a recent script I found that the preloading functions started to behave in an erratic manner in the preloading sequence.
For example, 20 images would normally load from number 1 to 20, but I was getting something like 1, 2, 3, 7, 9, 10, 15, 19, 20, and when the function should have stopped I found that after a few seconds the second function would continue starting and stopping showing additional numbers such as 23, 24, 27, 35 even though there was not this many images and the function was not being called from anywhere.
I was racking my brains because this should not be happening because the function was not being called at that stage, I checked my other scripts and all was ok.
Then I saw that the only difference with this latest script was the fact that I was preloading some animated gifs.
I took them out of the array and the preloader worked fine yet when I put them back in the script went haywire again.
I was just wondering if anyone could give me some sort of explanation as to why the animate gifs screw up my preloading
Function one is called and preloads the first image, when the image has loaded a second function is called to check for more images in the array, if there is another image then function one is called to preload it.
This is the basic cycle of the script and have implemented this in some scripts where I need to prevent functions from being run until all necessary images have been preloaded.
Everything works fine but....
In a recent script I found that the preloading functions started to behave in an erratic manner in the preloading sequence.
For example, 20 images would normally load from number 1 to 20, but I was getting something like 1, 2, 3, 7, 9, 10, 15, 19, 20, and when the function should have stopped I found that after a few seconds the second function would continue starting and stopping showing additional numbers such as 23, 24, 27, 35 even though there was not this many images and the function was not being called from anywhere.
I was racking my brains because this should not be happening because the function was not being called at that stage, I checked my other scripts and all was ok.
Then I saw that the only difference with this latest script was the fact that I was preloading some animated gifs.
I took them out of the array and the preloader worked fine yet when I put them back in the script went haywire again.
I was just wondering if anyone could give me some sort of explanation as to why the animate gifs screw up my preloading