【发布时间】:2011-04-03 13:26:02
【问题描述】:
我在一个动态添加到舞台的数组 (newStep) 中有影片剪辑。每次添加实例时,它都会随机选择要转到的帧。有一个嵌套的影片剪辑(stepLine),我需要更改它的 alpha。此代码实际上适用于将字符串添加到动态文本框(pointsDText),但是当我尝试访问嵌套影片剪辑(stepLine)时,它给了我 1009 空对象引用错误。有趣的是代码实际上可以工作并且确实改变了电影剪辑的 alpha,但我仍然得到那个错误,我认为它让我的游戏更加故障。我也尝试过使用 if(contains(steps[r].stepLine)) 但它不起作用。有没有更好的方法来访问此影片剪辑而不会出现错误?
if(newStep != null){
for(var r:int = 0; r<steps.length;r++){
if(steps[r].currentLabel == "points"){
steps[r].pointsDText.text = String(hPoints);
}
if(steps[r].currentLabel == "special"){
steps[r].stepLine.alpha = sStepAlpha;
}
if(steps[r].currentLabel == "life"){
steps[r].stepLine.alpha = hStepAlpha;
}
}
}
这很难解释,但我希望你能理解。
非常感谢。
【问题讨论】:
标签: arrays actionscript-3 nested movieclip