I notice that you don't have to removeChild
a DisplayObject
from it's parent before addChild
ing it to another container. If you just addChild
it to the second container, it will automatically be removed from its current parent first. Is there any point to doing removeChild
first if you're just going to addChild
it someplace else right after?
No, there is no point in doing removeChild()
first. The documentation clearly describes this behavior:
If you add a child object that already has a different display object container as a parent, the object is removed from the child list of the other display object container.
Adding a redundant call to removeChild()
only bloats the code.