I'm kind of new to this Javascript-thing, so forgive me if
I should have looked somewhere else. And now the
question: I'm trying to do some animation using javascript
in Netscape 3.0, and I would like to fetch the images from
the server before the animation starts. Is there a method like
preload(image) I could use to accomplish this?
Please send any answers by email,
thanks in advance,
Jeroen Koops
jer...@nl.euro.net
Yes. You can see how to do it at
http://home.netscape.com/eng/mozilla/3.0/handbook/javascript/index.html
Go to the section on the Image object.
There also an example of this on my page.
Anthony K. Chu
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Second Year Computer Science Major http://www.webhaven.com/anthony/
University of British Columbia, Canada <anth...@unixg.ubc.ca>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<SIDENOTE>
Ug.... I had to find all the little bits of junk, IE threw all over my
hard drie. Would you beleive that it set constants in my autoexec.bat .
Sombody take that computer away from Bevis!
<SUCKS>
IE
</SUCKS>
</SIDENOTE>
---
Ben Johnson's Classic Video Games
One Convenient Location:
http://www.halcyon.com/benj/
n = numberofImages;
ImgArray = new Array(n);
for (i=0;i>n;i++){
ImgArray[n] = New Image();
}
ImgArray[0].src = "whatnot.gif";
ImgArray[1].src = "your.gif";
--Cam
PS, is it my news server, or has this news group only gotten 8 messages
in the last 4 days?
>PS, is it my news server, or has this news group only gotten 8 messages
>in the last 4 days?
It is your server, I'm getting about , oh maybe 50 or so a day.
A reliable newsfeed seems to be the hardest thing for most ISPs to
provide.
Ummm.. I hope you don't.....
I think what you meant was:
for (i=0;i<n;i++) {
... just a slight bug.
BTW, there is no point calling 'new Array(n)'. JavaScript has dynamic property
allocation. It's quite happy with plain old 'new Array()'.
Another approach is to do something a bit nasty, but it works:
function Preload(prel,url,width,height) {
if(width && height)
prel = new Image(width,height);
else
prel = new Image();
prel.src = url;
}
then calling like:
imgs = new Array();
Preload(imgs[0],"one.gif");
Preload(imgs[1],"two.gif",50,70);
Preload(imgs[2],"title.gif",100,60);
etc, etc.
-----
Gavin Lambert
uec...@geocities.com
http://www.geocities.com/SiliconValley/Heights/1987