Reputation: 101
I have two buttons that are in a movieclip, how can I reference them like I have done with the 2 buttons below so that they can be added into an array?
container.anotherButton and container.anotherButton2 are the buttons I want to add to the array.
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);
}
Upvotes: 0
Views: 149
Reputation: 603
I am not sure what the question is, I think this is what you need.
var buttonArray:Array = new Array(container.anotherButton, container.anotherButton2);
The reference will hold even if you move the container/buttons.
Upvotes: 2