finalize

Type Event
Revision Release 2022.3683
Keywords finalize

Overview

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.

Properties

Example

local object = display.newImage( "ball.png" )

function object:finalize( event )
    print( "Finalizing:", self )
end

object:addEventListener( "finalize" )
object:removeSelf()