Do you need to cancel a transition on a display object (currently in transition obviously) before removing the object? For preventing memory leaks… or for any other reasons?
Thanks!
Gullie
Do you need to cancel a transition on a display object (currently in transition obviously) before removing the object? For preventing memory leaks… or for any other reasons?
Thanks!
Gullie
No. Only if you want to stop the transition before it has naturally completed.
I think if you are doing something with the object in an onComplete function and you remove the object before onComplete is called, then it might cause a nil reference error. So just to be safe, you should probably make sure that the object still exists in your onComplete before manipulating it.
So, short of creating display objects / groups and abandoning them, what are some good examples of ways to create memory leaks? So far the things I though I needed to tack and manually remove are not necessary. I am a bit unclear on the potential issue.
Thanks!
Gullie
Here’s one: Destroying display objects which have a listener on the runtime and not removing the listener.
Another: Creating a loop of objects (like a two-way linked list) which is not referenced by anything else. Some garbage collectors are clever enough to detect those, some are not.
Yet another: Creating joints or iterators/transitions/timers which don’t complete/are infinite, have no on-screen display and have no variable.
No. Only if you want to stop the transition before it has naturally completed.
I think if you are doing something with the object in an onComplete function and you remove the object before onComplete is called, then it might cause a nil reference error. So just to be safe, you should probably make sure that the object still exists in your onComplete before manipulating it.
So, short of creating display objects / groups and abandoning them, what are some good examples of ways to create memory leaks? So far the things I though I needed to tack and manually remove are not necessary. I am a bit unclear on the potential issue.
Thanks!
Gullie
Here’s one: Destroying display objects which have a listener on the runtime and not removing the listener.
Another: Creating a loop of objects (like a two-way linked list) which is not referenced by anything else. Some garbage collectors are clever enough to detect those, some are not.
Yet another: Creating joints or iterators/transitions/timers which don’t complete/are infinite, have no on-screen display and have no variable.