我创建了一个XML文件,其中包含一本书的列表, 现在阅读文件后,我想为列表中的每本书添加一个动画片段, 知道如何添加一个孩子,但我想为每个按钮命名不同,比如book1_button,book2_button等等, 我该怎么做? 继承人的代码:在Actionscript 3中添加子元素的循环3
function createChilds():void{
var i:Number = 1;
//For loop that iterates through all of the books in the XML file
for each (var bookID:XML in booksList) {
var bookButton:MovieClip = new book_btn;
this.addChild(bookButton);
i++;
}
}
您确实拥有MovieClip的'name'属性,对吧? – Subodh 2012-04-02 14:28:37