我有一个动态添加到舞台的数组(newStep)中的影片剪辑。每次添加实例时,它都会随机选择一个框架。有一个嵌套的影片剪辑(stepLine),我需要更改alpha的。此代码实际上用于向动态文本框(pointsDText)添加字符串,但是当我尝试访问嵌套的影片剪辑(stepline)时,它会给我1009空对象引用错误。有趣的是代码的实际工作,并确实改变了影片剪辑的alpha,但我仍然得到这个错误,我认为这使得我的游戏更加糟糕。我试过用if(包含(steps [r] .stepLine)),但它不起作用。有没有更好的方式来访问这个影片剪辑而不会出现错误?访问数组中某个帧的影片剪辑as3
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;
}
}
}
这很难解释,但我希望你能理解。
非常感谢。
修复了它。非常感谢! – user674528 2011-04-03 14:30:37