Click to See Complete Forum and Search --> : Preloading Images


Mr_Floppy
08-13-2003, 10:18 AM
Please explain why this dosn't work:

for (z=0; z>images.length; z++) {
for (y=0; y>images[z].length; y++) {
string="pictures/"+images[z][y]+".jpg";
imagel=new image();
imagel.src=string;
}
}

Images is a two dimensional array, btw.

Mr_Floppy

Khalid Ali
08-13-2003, 10:32 AM
you are looping through the array allright,however you are not storing the pre loaded image anywhere

you need to put the image in an array once you create it.

Mr_Floppy
08-13-2003, 10:59 AM
Ok, I added this before the loop:

var imagel1=new Array();
var imagel2=new Array();
var imagel=new Array(imagel1,imagel2);

and my code looks like this:

for (z=0; z>images.length; z++) {
for (y=0; y>images[z].length; y++) {
var string=new String("pictures/"+images[z][y]+".jpg");
imagel[z][y]=new Image();
imagel[z][y].src=string;
}
}

Still does not work.

Mr_Floppy

Khalid Ali
08-13-2003, 11:21 AM
you have a under development page on line somewhere???

Mr_Floppy
08-13-2003, 04:03 PM
Anyone else?

Mr_Floppy

Charles
08-13-2003, 04:11 PM
Khalid spoke for a goodly number of us here. You cannot expect us toprovide you with a solution if you aren't going to let us see the whole page. And cutting and pasting your code doesn't work. We need a URL.

Mr_Floppy
08-13-2003, 04:51 PM
Here's (http://heu.nationwidegalleries.com/) the link.

I am doing an online art gallery for someone. I am newbie at coding, so be gentle. :)

Mr_Floppy

Khalid Ali
08-13-2003, 05:39 PM
Put the image loop above this line

document.write('<table><tr><td>Please allow a moment for th

and then let us know what are the results

Mr_Floppy
08-14-2003, 02:33 PM
If I do that, then people will not get the notice until the loop is completed, defeating it's purpose.

Mr_Floppy

Mr_Floppy
08-14-2003, 11:16 PM
Anyone else?

Mr_Floppy

Mr_Floppy
08-15-2003, 02:35 PM
bump

Mr_Floppy
08-16-2003, 03:04 PM
SOMEONE HAS TO KNOW!!!