Need help with image loading/cache prob for Javascript game

  • PurpleFool
  • Born
  • Born
  • PurpleFool
  • Posts: 2

Post 3+ Months Ago


I'm a first time poster to this board (or any help board for that matter). But I've got a problem that has totally stumped me and I can't seem to figure it out on my own. So, hopefully someone here can help.

I've written a game using javascript, but I'm having some trouble with the images loading when playing the game on-line. Despite the fact that I'm reusing the same images over and over again,
the browser keeps loading the images from the server everytime the image is called. When I work offline I have no problems, but every time I run the game from the server it is really really slow cause it keeps reloading the images, even though I have made sure to pre-load the images and I have checked and they are stored in the cache.

Does anyone have any advise or suggestions to solve this problem?

Thanks.

PurpleFool

  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • PurpleFool
  • Born
  • Born
  • PurpleFool
  • Posts: 2

Post 3+ Months Ago

By the way, if anyone needs to take a look at the program to get a feel for the problem, the game can be found at:

http://throop.witwat.net/IV20/Internet Virus.html

(it is still a work in progress and due to this problem, it runs really slowly, but it's still fun to play)

Please let me know if anyone can help... I've now posted this on a few other boards and no one seems to have a clue. I really could use some help!

Thanks.

  • LazyJim
  • Student
  • Student
  • LazyJim
  • Posts: 92

Post 3+ Months Ago

Hi, first of all that dark strong purple text is very hard to read, the graphic designers of this forum chose dark bg with light - but not over-bright - text because it is easy on the eyes.

That game is pretty addictive :lol:

I only had to re-load the images a few times (or it was only noticable some of the times).

I havn't looked at your code, but I've been having similar problems in my own scripts, I suggest cloning the preloaded image node, but I havn't tried it yet.

Check out the DOM Core functions at PPK's site.
  • manuelvertiz
  • Born
  • Born
  • manuelvertiz
  • Posts: 1

Post 3+ Months Ago

try to use:

var img1=new Image();

in that way you oad the image on the memory and each time the site needs de pic, its already loaded on the "var img1";

:P

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 139 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.