473,387 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

"Loading" Graphic (Preload issue)

Hi,
I'm hoping for a bit of advise-- I have a (relatively, from the
point-of-view of this dilettante) complex script that attempts to preload
certain images in order to trigger one of a series of six slideshows
(rather than try to articulate, have a look here):

http://www.slack.net/~stacey/stestbed/homejs.jsp

Clicking any of the six blocks of text along the sides will begin a loop
of the corresponding slideshow.

Problem is, of course, there's a lot of loading here (blame the boss). It
seems to run fine on broadband, but, of course, dialup users are getting
broken images all over the place.

The "loading" graphics before the slideshow are really a tease-- just four
seconds of extra time to load the remaining images (not enough for
dialup).

My question is twofold:

-- Any tips, pointers, tutorials on if it's possible to make those
"loading" graphics functional loading graphics (e.g. rather than part of
the array, they stay put until the images I want are actually loaded)?

-or-

-- Any advise on how to properly preload images? (I've read that the
myriad examples we see of preload functions by way of calling the image is
a bit of a misnomer).

Any suggestions at all would be more than appreciated...
Jul 23 '05 #1
1 3351
I coulnd't get your example to run, in Netscape it shows the document
source (mime-type problem in the server?) and in explorer it gives
errors. I can imagine that some people might not like the following
code because of my misuse of arrays.

var plImages;
var pointer = 0;
var preloader;

function preload(filenames) {
if (preloader==null) {
// cancel previous preloading
window.clearTimeout(preloader);
}
plImages = filenames;
pointer = -1;
preloader = window.setTimeout("checkPreload();", 500);
}

function checkPreload() {
// need to load next?
if (pointer<0 || plImages[pointer].complete) {
// increment pointer
pointer++;
// loaded all images?
if (pointer>=plImages.length) {
// call complete
preloadComplete();
return;
} else {
// create other preloading image
img = new Image();
img.src = plImages[pointer]
plImages[pointer] = img;
preloadProgress(pointer);
}
}
window.setTimeout("checkPreload();", 500);
}

function preloadComplete() {
// fill this in
}

function preloadProgress(imagesLoaded) {
// fill this in
// for example:
pg = document.getElementById("progress");
pg.innerText = imagesLoaded+" of 6 images loaded";
// or
progressBlock = document.getElementById("pImage"+imagesLoaded");
progressBlock.src = "fillblock.gif";
}

// call:
preload(['image1.gif', 'images2.jpg', 'etc.gif']);
once loaded preloadComplete is called. For every complete image
preloadProgress is called.

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stimp | last post by:
I have two dropdowns that take a few seconds to populate (they are populated from a remote database, but the connection to the database is not the best). Is it possible to put a 'Loading...'...
3
by: Stimp | last post by:
I have two dropdowns that take a few seconds to populate (they are populated from a remote database, but the connection to the database is not the best). Is it possible to put a 'Loading...'...
2
by: dana lees | last post by:
Hi, I am developing a c# asp.net application. I have a button which when i click on i open a pdf file. Since the pdf file is very very large i would like to open a window that says "Loading...
3
by: bdog4 | last post by:
I've seen on some php forums that they use some type of popup box that I assume is javascript to display a animated gif/flash when you do a quick edit. My popup blocker does not detect it so I...
0
by: Terry Tang | last post by:
Hi There, We are extending Python interpreter to support special functions of our tools. What we did is to compile Python's source code (which is got from the an installation on a Linux...
3
by: Bri | last post by:
AC97 on WinXP, Image control on a Form and on a Report. I have followed the advice on the following MVPS page: http://www.mvps.org/access/api/api0038.htm This states that after changing the...
2
by: brianflannery | last post by:
Greetings! My situation is this. I currently have a database of which in a form displays jpeg pictures (one at a time) which are linked to the db and stored in a separate folder. I have set up a...
2
by: Curious | last post by:
There's a problem with what is displayed on a tab in my UI. At first, it's a message, "loading...". Then it should be replaced with the actual file name on the tab. Now the issue is that it...
7
by: saurabhsingh | last post by:
Can anyone plz suggest any Idea that How to implement "loading message" in a site with master pages. I am having Default page which is master page enabled and it contains many Gridviews with...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.