Closed Thread Icon

Topic awaiting preservation: javascript preloader Pages that link to <a href="https://ozoneasylum.com/backlink?for=8815" title="Pages that link to Topic awaiting preservation: javascript preloader" rel="nofollow" >Topic awaiting preservation: javascript preloader\

 
Author Thread
slim___shady
Nervous Wreck (II) Inmate

From: canada
Insane since: Aug 2002

posted posted 08-14-2003 16:37

I have this code to preload images that appear on mouseovers. The paths are fine.

code:
var aryImages = new Array(14);
aryImages[0] = "images/home-residence_05-over.gif";
aryImages[1] = "images/home-residence_06-over.gif";
aryImages[2] = "images/home-residence_07-over.gif";
aryImages[3] = "images/home-residence_08-over.gif";
aryImages[4] = "images/primary-menu_01-over.gif";
aryImages[5] = "images/primary-menu_02-over.gif";
aryImages[6] = "images/primary-menu_03-over.gif";
aryImages[7] = "images/primary-menu_04-over.gif";
aryImages[8] = "images/primary-menu_05-over.gif";
aryImages[9] = "images/primary-menu_06-over.gif";
aryImages[10] = "images/primary-menu_07-over.gif";
aryImages[11] = "images/primary-menu_08-over.gif";
aryImages[12] = "images/primary-menu_09-over.gif";

for (i=0; i < aryImages.length; i++) {
var preload = new Image();
preload.src = aryImages[i];
}



Is the code fine?
Do i need an onload event in the body tag.
If there are any mistakes, could someone please correct it and post it?

Thanx a lot.

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 08-14-2003 20:17

No you have to create an array of preloaded images


so something like

preload = new Array;
for(i=0;i<aryImages.length;i++){
preload[i] = new Image;
preload[i].src = aryImages[i];
}

then use the preload array to get your preloaded images



.:[ Never resist a perfect moment ]:.

mas
Paranoid (IV) Inmate

From: the space between us
Insane since: Sep 2002

posted posted 08-16-2003 19:28

see also: :FAQ:

slim___shady
Nervous Wreck (II) Inmate

From: canada
Insane since: Aug 2002

posted posted 08-23-2003 02:00

sorry for begin dense, but what would the full code look like?

« BackwardsOnwards »

Show Forum Drop Down Menu