复制一个影片剪辑的孩子的另一个影片剪辑 [英] Copy childs of one movieclip to another movieclip
问题描述
我有两个影片剪辑容器。
MovieClip_1 MovieClip_2
现在MovieClip_1包含一个子_child_1。现在pressing按钮,我想补充MovieClip_1到MovieClip_2那_child_1未经MovieClip_1删除。
我尝试以下code。在按钮preSS事件,但它消除_child_1从过去的容器。
变种MC:影片剪辑=影片剪辑(MovieClip_1.getChildAt(0));
MovieClip_2.addChild(MC);
这是不可能相同的显示对象添加到两个不同的父母。试图这样做会从它的前母公司删除显示对象。
相反,考虑建立你的孩子的类的新实例,该实例添加到容器MovieClip_2。
i have two movieclips container.
MovieClip_1 MovieClip_2
now MovieClip_1 contains one child _child_1. now by pressing button i want to add that _child_1 of MovieClip_1 to MovieClip_2 without removing from MovieClip_1.
i tried following code in button press event but it removes _child_1 from its past container.
var mc:MovieClip = MovieClip(MovieClip_1.getChildAt(0));
MovieClip_2.addChild(mc);
It is not possible to add the same display object to two different parents. Trying to do so will remove the display object from its former parent.
Instead, consider creating a new instance of your child's class and add this instance to the container MovieClip_2.
这篇关于复制一个影片剪辑的孩子的另一个影片剪辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!