View Full Version : Which Preloader Array Script?

02-24-2003, 10:36 PM
Can somebody tell me which script below is better for preloading images? If you know of a better one or see something that could be changed to work better, please let me know.

function preloader() {

// Set array for rollover images
AllImages=new Array("image1.gif",

for(loadall=0; loadall<AllImages.length; loadall++) {

var LoadedImage=new Image();


function preloader2() {

// Set array for rollover images
imag = new Array()

// scroll arrow images
imag[0] = "image1.gif"
imag[1] = "image2.gif"
imag[2] = "image3.gif"
imag[3] = "image4.gif"

// Preload images
if (document.images) {
im = new Array()
for (var i = 0; i < imag.length; i++){
im[i] = new Image()
im[i].src = imag[i]


02-25-2003, 12:35 PM
I think that second is better, as every image is assigned to a different variable, instead of using an unique one for all