I’m jumping into AS3 and I am lost yet again. So you no longer can tag actions onto an object??? Anyways. I’m setting up a navigation structure and popup menu. I’d like the buttons to share the same function. I hope this makes sense … it is completely wrong. Basically trying to set this up so I can list my buttons in the array and have them share everything. …
var buttonArray:Array = [b1, b2, b3]; // this would be my buttons/mc
for (var i: Number = 0; i < buttonArray.length; i++){
buttonArray.addEventListener(MouseEvent.MOUSE_OVER, over);
buttonArray.addEventListener(MouseEvent.MOUSE_OUT, out);
buttonArray.buttonMode = true;
function over(event:MouseEvent):void {
showPop(); // function to show menu
}
function out(event:MouseEvent):void {
hidePop(); // function to hide menu
}
}
If that is the wrong way to go about this do I need to use this for every clip I want to use as a button?
b1.addEventListener(MouseEvent.MOUSE_OVER, over);
b1.addEventListener(MouseEvent.MOUSE_OUT, out);
b1.buttonMode = true;
Wait, see I just thought of something. Previously I would write this something like this:
function myButtons(thisInfoFromButton) {
// do stuff here
}
Then I’d assign this on the button:
on(press){
myButtons(thisInfoFromButton);
}
If you can’t add actions to objects aren’t you writing a ton more? I am so lost. Thanks.