Is it ok to call :removeSelf() while a sprite is playing

For example, I create a sprite and assign its parent

    mySprite = display.newSprite( myParentGroup, myImageSheet, sequenceData )
 

And later, I may want to remove its parent by

    myParentGroup:removeSelf()

Do I need to care if mySprite is playing?

Do I need to care if any children in myParentGroup is not in the middle of a transition.to()?

Anything I need to be care before I call :removeSelf() on myParentGroup?

The updated call is ‘display.remove( yourObject)’.

I do have a sprite playing and I remove the parent (when changing pages). Don’t see any issues with it so far…

I don’t think there would be any issue with removing a playing sprite. No doubt I’ve done it countless times before and never even considered that it might be an issue. :slight_smile:

Brent

You should  care if you do anything with the Object on timer or transition callback

That sample will cause errors:

timer.performWithDelay(100,function() object.x = object.x + 5 end) object:removeSelf()

 It’s same if you do anything on transition onComplete listener.

Thanks for the clarifications.

The updated call is ‘display.remove( yourObject)’.

I do have a sprite playing and I remove the parent (when changing pages). Don’t see any issues with it so far…

I don’t think there would be any issue with removing a playing sprite. No doubt I’ve done it countless times before and never even considered that it might be an issue. :slight_smile:

Brent

You should  care if you do anything with the Object on timer or transition callback

That sample will cause errors:

timer.performWithDelay(100,function() object.x = object.x + 5 end) object:removeSelf()

 It’s same if you do anything on transition onComplete listener.

Thanks for the clarifications.