...

View Full Version : Which Preloader Array Script?



John_Saunders
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",
"image2.gif",
"bluecirc.gif",
"greencirc.gif",
"redcirc.gif",
"blackcirc.gif"
);

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

var LoadedImage=new Image();
LoadedImage.src=AllImages[loadall];
}

}


function preloader2() {
switchSection(1);
}

// 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]
}
}


John

Borgtex
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum