View Full Version : How do I KNOW that preloading really works?

04-03-2003, 09:20 PM
I have the page http://XFox_Prower.tripod.com/games/js/slide/miles that has several tiny images and takes about 10 seconds to load (though the total size is only about 3 kb). And when I reload the page, it wasn't stored in cache. I preloaded the images and nothing is working as it is supposed to. I've tested it on slow connections, tested offline on slow removable media, everything. What is wrong with this?

bg2=new Image()
c2=new Image()
p20=new Image()
p21=new Image()
p22=new Image()
p24=new Image()
p25=new Image()
p26=new Image()
p27=new Image()
p28=new Image()
p29=new Image()
p2a=new Image()
p2b=new Image()
p2c=new Image()
p2d=new Image()
p2e=new Image()
p2f=new Image()
pa=new Image()

I'd go into arrays and a for loop, but if this won't work, neither would that. I don't know why it isn't working or what is wrong. IE 5.0 and 6.0 throw no error messages at me.

04-03-2003, 10:00 PM
you have a thread with the same topic already? :)

04-03-2003, 10:32 PM
I did not intend to double post. In fact, I don't even remember that post. But why is this not working? Does the page work for you? Is my script wrong? does IE not support preloading?

04-04-2003, 03:11 AM
everything *looks* fine to me, it loaded with the page. IE6
took no time to load.

04-04-2003, 09:15 PM
That worked.

bg2=new Image()

document.write('<img src="'+bg2.src+'" />')

So I guess I have to put all my html in javascript writes? I'd like to use a for loop with arrays then. I tried and it didn't work. But I was in such a hurry, I wonder if I had the array full of objects before the objects were created was the reason for the undefined errors.

Can someone tell me how you can look for posts someone has made? If I knew how to look, I would have made sure I wasn't double posting. And I don't remember those replies to my old post, but I do remember a time when I clicked the links in the notify email and they were links to bad threads.

04-04-2003, 09:34 PM
Originally posted by Tails
Can someone tell me how you can look for posts someone has made?
If you click someone's "profile" button, then at the top-right of the info table there's a link - "Search for all posts by this user." I often do it on myself.

(btw - I've closed your other thread, so it can continue in this one. I know you didn't mean it, but please do try not to have multiple threads going on the same question; you can pick a thread up weeks after you originally posted it, there's no time limit on individiual threads)

Anyway - you can use arrays to preload images; something like this (assuming sequentially numbered images)

var imgs = new Array;
for(var i=0; i<5; i++)
imgs[i] = new Image;
imgs[i].src = "pics/picture" + i + ".gif";

04-04-2003, 10:13 PM
or you can click "search" on the top right of every page, you can search for user names etc. :D

04-12-2003, 09:38 PM
Can you check if the preloading works on this page? http://xfox_prower.tripod.com/games/js/slide/miles
The images are loaded from objects, but they aren't being preloaded. Maybe cache isn't supported on this browser. So can I get a second opinion? Preferably from someone that doesn't own their own planet or satellite, etc and has just a fair connection?

04-13-2003, 06:53 AM
Originally posted by Tails
... can I get a second opinion? Preferably from someone that doesn't own their own planet or satellite, etc
lol, i have a dialup, the page loads first, then images, like normal. :confused:

04-13-2003, 11:55 AM
You can use the onload and onerror event handlers.


04-15-2003, 09:29 PM
Well that's the funny thing. Everything returns as true for all image.complete. But the computers I am testing on don't seem to like cookies and probably don't even know what cache is (Either Windows 2000 is a downgrad or it is disabled). But if you say it works fine, then that's what's important. Hmm, now to work on a progress bar. I have one problem with it. When I click scramble, it shows a load percent between a function. But the real loading time is undetectable because the processor is thrown into a sudden panic which takes about 10 seconds on any modern machine. Take a look. I can't seem to get a variable to refresh with each function load even with a setInterval. I'll mark the details later, the code is quite crammed, and I don't have time at the moment.