2 Replies Latest reply on Oct 20, 2008 11:27 AM by Newsgroup_User

    Pre-loading external images for XML-based gallery

    0degreesK Level 1
      I'm working-on an XML-based photo gallery here:

      It works how I want it, except that the first time a thumbnail is clicked for an image, it pauses long enough to skip the fade. If you click-through the images a second time, you'll see that it works smoothly. My guess is that the first time the thumbnail is clicked, the image isn't cached, yet.

      I tried to fix this by creating a JavaScript file for the page to pre-load each image and thumbnail:
      0003a = new Image;
      0003a.src = "images/Down-Range.jpg";
      0003b = new Image;
      0003b.src = "thumbnails/Down-Range.jpg";

      But that didn't work. What would be the best way to do this?

      I included a link to "Download ZIP" of the FLA project on this page, too, because it wouldn't be easy for me to describe what's happening. In a nutshell, a thumbnail click launches a function that loads the appropriate image into the main image holder. What seems to be happening the first time is the image isn't loaded before the fade is finished, so the image just appears after a short pause the first time.