1 Reply Latest reply on May 8, 2006 6:07 AM by blemmo

    misery pre-caching images

    Chris Ivey
      I am working on a large app that is populated with dynamically loaded images. I have been loading on demand, but there are points where it would make sense to pre-cache a lot of the images that get reused. Trouble is, since each image is dynamically loaded into a complicated hierarchy of movie clips, preloading the images into a temporary container doesn't seem to work. Flash requests the same file from the server AGAIN when it comes time to populate the clip and apply behaviours.

      Someone suggested to me that I use the bitmapData object, but I can't find any documentation on this that would allow me to populate it with an image that isn't already loaded into a library with a linkage identifier.

      I need a way to fetch images so I can reuse them inside different entities without having to reload them. Does anyone have any ideas?
        • 1. Re: misery pre-caching images
          blemmo Level 1

          you can load the images into some (temporary) MC. Then create a BitmapData object, and draw the MC with the image into this object, using the draw() method of BitmapData. Now you can attach this object to any MC you like.
          Be aware that every BitmapData object takes up memory, so don't forget to dispose() them if they are not needed anymore.