Are the emitters attached to the objects deleted when the objects are deleted? [import]uid: 54716 topic_id: 17782 reply_id: 317782[/import]
I’m assuming you’re talking about ‘event listeners’ and yes, in most cases, listeners are removed from objects when removeSelf() is called on that object.
However, Runtime event listeners do not get removed automatically, even if the listener function is a table attached to the object.
Here’s an example:
local myObject = display.newImage( "myObject.png" )function myObject:touch( event ) if event.phase == "began" then print( "Began touch on myObject." ) end return trueend-- start listening to touches on myObjectmyObject:addEventListener( "touch", myObject )function myObject:enterFrame( event ) --- enterframe listener functionend-- start enterFrame listener, listener attached to myObjectRuntime:addEventListener( "enterFrame", myObject )-- touch listener will be removed automatically, but-- enterFrame listener wont because it is attached to the-- Runtime object. It needs to be removed automatically:Runtime:removeEventListener( "enterFrame", myObject )-- then, you can remove myObject, which will also remove the-- touch listenermyObject:removeSelf()myObject = nil[/code] [import]uid: 52430 topic_id: 17782 reply_id: 67847[/import]
Thanks for the response, but no I am talking about Particle Candy Specific “Emitters”. [import]uid: 54716 topic_id: 17782 reply_id: 68415[/import]
No, emitters are not deleted automatically when removing their parent, you should always remove emitters properly (using the related Particle Candy commands) BEFORE deleting the parent object.
When you delete an emitter’s parent object, the visible emitter display object (the arrow symbol) will be deleted only whilst some associated data still stays in memory. This would lead to error messages when Particle Candy tries to access the emitter object.
[import]uid: 9644 topic_id: 17782 reply_id: 70757[/import]
Thanks MauMau. [import]uid: 54716 topic_id: 17782 reply_id: 70766[/import]