|
|
#1 |
|
New Member
![]() Join Date: Nov 2010
Posts: 8
|
Hi!
I've just started experimenting with preloading of images with Javascript to speed up things, by loading new Image objects and setting the src to images likely to be needed in the future. My question is, do you need to attach the object to a variable, or can you save memory by just apply them "on the fly"? E.g. on the first page of www.metropolisonline.org I have 4 clickable screenshots from the game (i.e., only thumbnails on the first page). Then, in the body onload, I create an array of 4 new Image objects and set the them to the screenshots e.g. Code:
a[0].src = 'images/screenshot1.png'; I'm just wondering if I need the array at all? Is it possible to do Code:
new Image().src='images/screenshot1.png' Iv'e seen similar code on the Google front page, but does it work? |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|