2012-07-04 135 views
0

删除这将删除所有的孩子我可拖动层:添加/从舞台AS3

while(draggableLayer.numChildren){ 
       draggableLayer.removeChildAt(0); 
      } 

但他们只是消失在舞台上,我怎么可以在后面加上这些的阶段?

回答

0

removeChildAt返回删除的DisplayObject。您可以将其存储在Array或其他数据结构中,如果需要它可以稍后添加。

var removedChildren:Vector.<DisplayObject> = new Vector.<DisplayObject>(); 
while(draggableLayer.numChildren) 
{ 
    removedChildren.push(draggableLayer.removeChildAt(0)); 
} 
+0

太棒了!效果很好。将尽快接受 – panthro