我有按钮,它是带有字母实例名称的影片剪辑。我想使用 for 循环来获取价值。这是代码
var buttons:Array;
buttons = new Array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H','I', 'J', 'K', 'L',
'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z');
function gettracedValue {
for(var i= 0; i < buttons.length; i++ ) {
var btnName:String = buttons[i];
trace("Buttons " + btnName);
btnName.addEventListener(MouseEvent.MOUSE_UP, traceValue);
} //end for
}//end gettracedValue
function traceVaalue():void{
trace("Clicked: " + event.target.name);
}
当我运行我得到的代码时
TypeError: Error #1010: A term is undefined and has no properties.
at hangMan_fla::MainTimeline/gettracedValue()