Click to See Complete Forum and Search --> : Preload for Image Cycler


Jasper777
10-15-2003, 02:10 AM
Hello. I've been trying for a week to get this to work right and its just not working for me. I have an image cycler on my website.....

http://www.freewebs.com/ycmonline/

and I CANNOT figure out how to get the images to preload before they start cycling. Everytime I alter the code to include the preload I either don't have any effect on the function of the cycler at all or the pics won't load period. I'm very new to Java...any advise would be greatly appreciated. Thanks,

~Jasper

lillu
10-15-2003, 03:02 AM
Very trivial:

Just put the image source correctly in the <img> tag and in the array eg. imagename.fileextension

var Pix = new Array
("http://jasper777.tripod.com/behindalex.jpg"
,"http://jasper777.tripod.com/alexoncage.jpg"
,"http://jasper777.tripod.com/preenbird.jpg"
,"http://jasper777.tripod.com/thirstybird.jpg"
);

<img name="ChangingPix" src="http://jasper777.tripod.com/behindalex.jpg">

Well, it's not a good idea to display any content that resides on another server anyway. Copy them to the directory you have the page in and just use relative path. eg. behindalex.jpg

Jasper777
10-15-2003, 10:28 AM
lillu...

Ok, took your advise...and its working much better, but still not doing what I'm going for. The problem I'm trying to fix is every time the image cycles to the next image it has to stop.....and download the next image. This is making it cycle very slowly and the downloads are running into each other causing some of the pics not to be fully loaded before the next one starts to load....ok....let me try again...

When the page initially loads, I'd like all the images in the cycler to load then. This way I can set the cycle speed a little faster, and not have to wait for the photo to load everytime the photo changes. Does this make any sense? I hope this is more clear to you. Thank you for the help. Its doing this part of the time now? It stops the first cycle, downloads all the images, and then cycles normally. Can I make all the images load when the page initially loads?

~Jasper


Oh, and the reason some of my pics are on another server is because I have two pages that use pretty much the same pics. I was just trying to save time from loading them twice :D Again, thanks for your help.

---Alright...I've been sitting here longer watching it...here's what its doing now. The first image in the cycle...the "behindalexweb.jpg" is downloading each time....Then the others are cycling normally.

lillu
10-16-2003, 02:29 AM
Works fine for me probably because I have the pictures in the same directory.
You can preload pictures programatically but what for when you download them from a remote location? That doesn't really make sense for me. It is strongly unadvised to use this technique.
Lastly, what do you think is more resource wasting: sacrifying a little bit more storage place on your or your host's hard disk, or generating extra and unnecessary traffic on the net?
After all, I let you decide which.

Jasper777
10-16-2003, 12:03 PM
I've already moved the pics over to the same server...its still not working. That's why I posted the reply. Because after I moved them it still isn't working properly.

~Jasper

Mr J
10-18-2003, 05:27 AM
How big are the images and what is the type of connection?

56k or Broadband

Jasper777
10-18-2003, 10:50 AM
The pics are all 300 x 225 somewhere between 18 and 30kb each.

My connection is 56k but I checked it on a friend's with DSL....seems to be working alright on DSL. I'm assuming that's because they load so quickly that you don't notice it. Isn't there a way to make everything download when the page initially does...so I can make the pics cycle faster?

~Jasper