Arrays 数组中的AS3按钮引用
我有两个按钮在一个movieclip中,我如何引用它们,就像我使用下面的两个按钮那样,以便将它们添加到一个数组中 container.anotherButton和container.anotherButton2是我要添加到数组中的按钮Arrays 数组中的AS3按钮引用,arrays,actionscript-3,flash-cs5,Arrays,Actionscript 3,Flash Cs5,我有两个按钮在一个movieclip中,我如何引用它们,就像我使用下面的两个按钮那样,以便将它们添加到一个数组中 container.anotherButton和container.anotherButton2是我要添加到数组中的按钮 var agreeButton:SimpleButton; var disagreeButton:SimpleButton; var buttonArray:Array = new Array(agreeButton, disagreeButton); for
var agreeButton:SimpleButton;
var disagreeButton:SimpleButton;
var buttonArray:Array = new Array(agreeButton, disagreeButton);
for (var i:int = 0; i < buttonArray.length; i++) {
buttonArray[i].addEventListener(MouseEvent.CLICK, mouseClick);
}
var协议按钮:SimpleButton;
var按钮:SimpleButton;
var buttonArray:Array=新数组(agreeButton,discoverbutton);
对于(var i:int=0;i
我不确定问题是什么,我想这就是你需要的
var buttonArray:Array = new Array(container.anotherButton, container.anotherButton2);
即使您移动容器/按钮,参考也将保持不变。谢谢。我不知道为什么我把它复杂化了。不管您如何将组件添加到显示列表中,引用都会保持不变,因为每个对象的引用都是唯一的,并且与该对象在机器内存中的特定位置相关。Flash显示列表中该对象的路径对引用的值没有影响。