How to pre-load large images for later use?

Is it possible to pre-load a large image for later use without actually displaying it on the screen? Just looking to simply cache it so that when I need it I can display it instantly.

Thanks!

Yes you can. Use the network.* function, and save it to a directory (maybe temp directory). With that filename, you can use display.newImage to show it instantly.

Is it possible to pre-load a large image for later use without actually displaying it on the screen? Just looking to simply cache it so that when I need it I can display it instantly.

Thanks!

I’m just a newb, but another thing I’ll do is create the image as normal first using newImage() or newImageRect(), and then I’ll set the image’s visibility to false, like if I’ve called the image happyBackground, then this:

happyBackground.isVisible = false

Then you can use an “if” statement to check for your condition, and if it’s met, change happyBackground.isVisible = true, and the image will appear. This isn’t exactly a cache, but if you’re looking for speedy processing of a few images at a time, this works. Hope that helps. 

Yes you can. Use the network.* function, and save it to a directory (maybe temp directory). With that filename, you can use display.newImage to show it instantly.

Is it possible to pre-load a large image for later use without actually displaying it on the screen? Just looking to simply cache it so that when I need it I can display it instantly.

Thanks!

I’m just a newb, but another thing I’ll do is create the image as normal first using newImage() or newImageRect(), and then I’ll set the image’s visibility to false, like if I’ve called the image happyBackground, then this:

happyBackground.isVisible = false

Then you can use an “if” statement to check for your condition, and if it’s met, change happyBackground.isVisible = true, and the image will appear. This isn’t exactly a cache, but if you’re looking for speedy processing of a few images at a time, this works. Hope that helps.