var menuButton:Array = new Array(3); //the overarching menu buttons, these lead to a submenu
for (i = 0; i <= 3; i++)
{
menuButton[i] = new BattleActionButton(); //creates the button
menuButton[i].buttonID = i;
if (i != 0) //if there is a previous button then it positions itself under it
{
menuButton[i].y = menuButton[i - 1].y + menuButton[i - 1].height;
}
else //otherwise it positions itself under the lowest friendlyFrame
{
menuButton[i].y = friendlyFrame[4].y + friendlyFrame[4].height;
}
menuButton[i].addEventListener(MouseEvent.CLICK, addSubMenu);
stage.addChild(menuButton[i]);
}
我正在尝试向这些按钮添加一个属性,以便稍后使用 EventListener 识别它们,但我不断收到此错误:
ReferenceError:错误 #1056:无法在 BattleActionButton 上创建属性 buttonID。
在 Main/createBattleGUI()
在主要()
任何帮助表示赞赏。