Menu using Array

Hi, I’m beginning to look at using Arrays for menus as they are cleaner.

Arrays are new to me, and I have problems getting them to work.

Currently I’m doing something like this.

menu1.onRollOver = function() {
menu1.gotoAndStop(“Selected”);
};
menu1.onRollOut = function() {
menu1.gotoAndStop(“Normal”);
};
menu1.onRelease = function() {
do something;
};

This is the code I’ve tried and it doesn’t work.

var mainMenu:Array = [“menu1”,“menu2”,“menu3”,“menu4”];
for (i = 0; i < mainMenu.length; i++) {
mainMenu*.onRollOver = function() {
mainMenu*.gotoAndStop(“Selected”);
}
};

Somebody advise me on how I should get it working?