...

View Full Version : Preloader Not Working



BigPete
06-03-2005, 02:41 AM
Can some of you check my code and see why it is not working? I have an array of images, and a function which should preload them. But alas, it does not. Here's the code:


var pics = new Array()
{
pics[0] = "images/gallery/ff/ff1.jpg"
pics[1] = "images/gallery/ff/ff2.jpg"
pics[2] = "images/gallery/ff/ff3.jpg"
pics[3] = "images/gallery/ff/ff4.jpg"
}
function preloader()
{
imageObj = new Image();
for(i=0; i<total; i++)
{
imageObj.src=pics[i];
}
}

Willy Duitt
06-03-2005, 03:03 AM
imageObj[i].src=pics[i];

Edit: BTW... what the heh is total??
That should be pics.length....

BigPete
06-03-2005, 06:33 PM
sorry, i didn't put that in there. total is a variable i put in which is pics.length.

so, all i need to change is that one line? I'll give it a try.

BigPete
06-03-2005, 06:40 PM
ok, i think i have it working. i changed it to:


function preloader()
{
for(i=0; i<pics.length; i++)
{
imageObj[i] = new Image();
imageObj[i].src = pics[i];
}
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum