Click to See Complete Forum and Search --> : Problems with PreLoad


TZZ
04-15-2003, 09:34 PM
Hi - I'm new to JavaScript and I'm having trouble with preloading images. I swear I had it working correctly at one point, but now it is taking a very long time to load. Would someone be so kind as to take a look at my site and advise me on what I've done wrong? Not sure if the problem is the frames or the preload script. Thanks, TZZ
http://prospicephotography.com/wedding.htm

DrDaMour
04-15-2003, 09:42 PM
so you want the wedding photos to be pre-loaded? Because you don't have them loaded, you're loading the html, which i don't think you can do. At least i've never seen it done correctly. You'll have to load the images in your loop.

TZZ
04-15-2003, 09:55 PM
It's changed back to loading the jpegs, still doesn't seem to work...

DrDaMour
04-15-2003, 10:00 PM
dave the preloading is ther, but it's hidden in the main index.html file. You'll hvae to go to view->view source to see the index source.

but again, i think since you are chaning the html the preloading may be messed, what you'll probalby have to do, is instead of loading a new html page, you'll just have to change the src of the image, and stick to one html page. I suggest getting rid of the frames to do this. It'd make the whole thing simpler

TZZ
04-15-2003, 10:13 PM
I might ditch the frames, that would make it easier, however, not all the images are the same size, so I thought frames with HTML pages for the images would work better than just changing the src. Otherwise the images get stretched if they are not the standard size.

DrDaMour
04-15-2003, 10:52 PM
there are ways around this, and actually i've never noticed this problem unless you specify width & height. One way i know is that new Image(width,heigth) creates the image with specific values, then you can do things based off of that. Although you sure are going through a lot of trouble it seems, to just preload some images, hehe.

DrDaMour
04-16-2003, 07:34 AM
so overwriting a variable calls the delete function on it? I didn't know JS had garbage collecting like that.

TZZ
04-16-2003, 08:10 AM
Thanks Dave, I applied the change. Do I also need to change the function named doPreload()?
I'm unsure if the path for each image needs to be "wedding_files/bw1_files/image001.jpg" or just "bw1_files/image001.jpg" does JavaScript automatically look in the matching folder to the HTML file it is written in or does it need to be manually directed?

DrDaMour
04-16-2003, 09:04 AM
it's relative to the location of the html file that the script is in