所以我在我的库中提供了一个movieclip,我已将其添加到舞台中,它包含更多组件,我能够使用以下方法获取有关这些组件的信息:
try
{
for (i = 0; i < musicControls.numChildren; i++){
trace ('\t|\t ' +i+'.\t name:' + musicControls.getChildAt(i).name + '\t type:' + typeof ( musicControls.getChildAt(i))+ '\t' + musicControls.getChildAt(i));
}
}
catch (error:Error)
{
trace("Failed:", error.message);
}
上面的脚本返回了下面的信息。我想问现在有没有办法通过索引访问这些孩子。例如,movieclip 中的组件之一是进度条我将如何引用它?我尝试使用 getChildByName 但它不起作用,在寻求帮助时,每个人都说使用它很慢。如果这是一个基本的问题,我很抱歉,我不太擅长 as3。
| 0. name:plyControl type:object [object Button]
| 1. name:stopControl type:object [object Button]
| 2. name:nextControl type:object [object Button]
| 3. name:prevControl type:object [object Button]
| 4. name:progressControl type:object [object ProgressBar]
| 5. name:volControl type:object [object Slider]
| 6. name:__id11_ type:object [object MovieClip]
| 7. name:__id12_ type:object [object TLFTextField]
| 8. name:instance71 type:object [object MovieClip]
| 9. name:vizControl type:object [object ComboBox]
| 10. name:__id13_ type:object [object MovieClip]
| 11. name:__id14_ type:object [object TLFTextField]
| 12. name:instance74 type:object [object MovieClip]
| 13. name:__id15_ type:object [object MovieClip]
| 14. name:timeControl type:object [object TLFTextField]
| 15. name:instance75 type:object [object MovieClip]
编辑:或者看起来非常擅长语法和拼写....