a) Netscape refuses to use cashed images, it will hit the server every time.
b) Solution: Preload the image yourself into an array
 
var ImageArray = new Array();
ImageArray[0] = new Image;
ImageArray[0].src = "the image source"
 
do this for all images..
then in the code that switches the images:
 
Button.src = ImageArray[0].src;
 
This should prevent the browser from hitting the server for the images
----- Original Message -----
From: Jim Foster
Sent: Monday, April 02, 2001 8:31 PM
Subject: [Dynapi-Dev] PreLoading menu button graphics and precreation()

Hello, everyone:
 
I am constructing a menu array of site navigational buttons. I am approaching this from the standpoint of widget creation. My sitenav button widget follows the excellent tutorial presented by Pascal at http://dynapi.sourceforge.net/dynapi/content.php?page_id=7 exactly.
 
It works beautifully except for one small thing: on the initial mouseover of a button there is about a second delay while the browser runs back to the server, presumably to fetch the graphics to show for the mouseover. After the initial mouseover the graphics are in the browser's cache, of course, so there is no delay on subsequent mouseovers.
 
Now, it was my understanding from Pascal's tutorial that precreation() took care of gathering all the graphics together in the browser's cache before display. I wish to know what I am doing wrong, or if my understanding of Pascal's tutorial is amiss...or any other words of wisdom would be greatly appreciated.
 
Jim

Reply via email to