【发布时间】:2012-04-02 14:18:54
【问题描述】:
我创建了一个包含书籍列表的 XML 文件, 现在阅读文件后,我想为列表中的每本书添加一个电影剪辑到舞台, 我知道如何添加一个孩子,但我想以不同的方式命名每个按钮,比如 book1_button、book2_button 等等, 我怎么做? 代码如下:
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' 属性,对吧?
标签: xml arrays actionscript-3 actionscript