AS3:需要在addChild 之前删除Child?

AS3: Need to removeChild before addChild?

我注意到在 addChild 将其 addChild 发送到另一个容器之前,您不必从它的父容器中 removeChild a DisplayObject。如果你只是 addChild 它到第二个容器,它会自动从当前父容器中删除。如果你只是想 addChild 之后马上去别的地方,那么先 removeChild 有什么意义吗?

不,先做 removeChild() 没有意义。 The documentation 清楚地描述了这种行为:

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.

添加对 removeChild() 的冗余调用只会使代码膨胀。