I’m trying to condense some of this script. I’ve come a long way but I think it could be better. Is there a way I could condense this anymore?
//
buttonArray = [];
buttonArray[0] = [designButton, function () {
gotoAndStop ("homedesign");
section.text = "Home Design";
setMenu (0);
}];
buttonArray[1] = [paintingButton, function () {
gotoAndStop ("about");
section.text = "About";
setMenu (1);
}];
buttonArray[2] = [about, function () {
gotoAndStop ("about");
section.text = "About";
setMenu (2);
}];
buttonArray[3] = [commercial, function () {
gotoAndStop ("commercial");
section.text = "Commercial";
setMenu (3);
}];
buttonArray[4] = [interior, function () {
gotoAndStop ("interior");
section.text = "Interior";
setMenu (4);
}];
buttonArray[5] = [exterior, function () {
gotoAndStop ("exterior");
section.text = "Exterior";
setMenu (5);
}];
buttonArray[6] = [contact, function () {
gotoAndStop ("contact");
section.text = "Contact";
setMenu (6);
}];
//
function setMenu (n) {
for (var i:Number = 0; i < buttonArray.length; i++) {
if (i != n) {
buttonArray*[0].gotoAndStop ("up");
buttonArray*[0].func = buttonArray*[1];
buttonArray*[0].onRollOver = function () {
this.gotoAndStop ("over");
};
buttonArray*[0].onRollOut = function () {
this.gotoAndStop ("up");
};
buttonArray*[0].onPress = function () {
this.onEnterFrame = this.func;
};
buttonArray*[0].onRelease = function () {
delete this.onEnterFrame;
delete this.onRollOver;
delete this.onRollOut;
};
}
buttonArray[n][0].gotoAndStop ("active");
}
}
setMenu (2);