`

【as3手册小记】一个显示实例只能在一个显示容器

    博客分类:
  • flex
 
阅读更多

tf1:TextField = new TextField();
tf2:TextField = new TextField();
tf1.name = "text 1";
tf2.name = "text 2";
container1:Sprite = new Sprite();
container2:Sprite = new Sprite();
container1.addChild(tf1);
container1.addChild(tf2);
container2.addChild(tf1);
trace(container1.numChildren); // 1
trace(container1.getChildAt(0).name); // 文本 2
trace(container2.numChildren); // 1
trace(container2.getChildAt(0).name); // 文本 1
 

如果将在第一个显示对象容器中包含的某一显示对象添加到另一个显示对象容器中,则会从

第一个显示对象容器的子级列表中删除该显示对象。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics