Clear cache?

 I am taking a screenshot with display.save and saving the image file to the temporary directory.

Problem is when I do this again and overwrite the file, it still shows me the old pic as if it is stuck in the cache. Is there a way for me to clear it out or just delete the pic when I am done with it?

I’m pretty sure you need to use a new name each time to get a new image to show if you display the screenshot.

Thanks @roaminggamer.

I did find out that if you leave the scene where you are taking the snapshot, remove the scene by using composer.removeScene( composer.getSceneName( “previous” ) ) and load the scene up again, the snapshot will show the new one.

Luckily, that is the process I needed this time around.

Still, you’d think there would be a display.delete to go along with the display.save function.

there is: “display.remove()”.  just make sure the screenshot is removed from the display and nil’d out so that all references to it are removed from memory (this is effectively what your scene disposal is doing for you) and the next time you load that image it’ll have to re-aquire it from disk.  if you don’t completely destroy a prior one, then later ones with the same filename will re-use what it believes to be an already-loaded cached texture - that behavior is by design.

I’m pretty sure you need to use a new name each time to get a new image to show if you display the screenshot.

Thanks @roaminggamer.

I did find out that if you leave the scene where you are taking the snapshot, remove the scene by using composer.removeScene( composer.getSceneName( “previous” ) ) and load the scene up again, the snapshot will show the new one.

Luckily, that is the process I needed this time around.

Still, you’d think there would be a display.delete to go along with the display.save function.

there is: “display.remove()”.  just make sure the screenshot is removed from the display and nil’d out so that all references to it are removed from memory (this is effectively what your scene disposal is doing for you) and the next time you load that image it’ll have to re-aquire it from disk.  if you don’t completely destroy a prior one, then later ones with the same filename will re-use what it believes to be an already-loaded cached texture - that behavior is by design.