Tutorial :Image browser caching. Flex



Question:

I am trying to load an image in Flex from different places, and the image always loads from server again and again.

Is there any way to load the image from browser cache?

Thanks,
Vladimir


Solution:1

If you know that you are going to be loading the image in 4 different places have you considered embedding the image inside the swf, then you wouldn't need to load it at all.

If that isn't an option then you could create a Dictionary of images, using the source of the image as the key. If a particular key hasn't been populated then you haven't loaded that image yet, and if it is populated then you can reference the image from the Dictionary (that way you only load it once).

Place the Dictionary inside a singlton class so that it can be made accessable from anywhere in your app.

Kenneth.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »