Type Event Revision Release 2022.3683 Keywords finalize
This event is delivered to a display object when an object is removed from the scene, for example via object:removeSelf(). This is useful if you have cleanup that needs to be performed when the associated object is removed from the scene.
local object = display.newImage( "ball.png" ) function object:finalize( event ) print( "Finalizing:", self ) end object:addEventListener( "finalize" ) object:removeSelf()