as3 check to see if item in array has been clicked
Sorry if this is a little n00b-ish. I'm working in AS3. I've got an array of 8 buttons. I'm currently hiding the button that is clicked using e.currentTarget.
How can I tell flash to make all the buttons that aren't the currentTarget to become visible (i.e. if a button has been hidden by previously being clicked, how do I tell it to become visible again when another button is clicked?)
Thanks in advance for any advice. Below is what I am using to hide the par开发者_JS百科ent of the currentTarget:
buttonArray[i].addEventListener(MouseEvent.MOUSE_DOWN, officeButtonSelected);
function officeButtonSelected (e:MouseEvent){
e.currentTarget.parent.visible=false;
}
When you detect a click, simply loop over all buttons and make them visible before hiding the one that was clicked.
for each( var button:DisplayObject in buttonArray){
button.visible = true;
}
精彩评论