# Menu using Array

**URL:** <https://forum.kirupa.com/t/menu-using-array/253202>\
**Category:** flash\
**Created:** [February 28, 2008, 2:54am UTC](https://forum.kirupa.com/t/menu-using-array/253202 "2008-02-28T02:54:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vampyre](https://avatars.discourse-cdn.com/v4/letter/v/71e660/32.png) [@Vampyre](https://forum.kirupa.com/u/Vampyre)\
**Post date:** [February 28, 2008, 2:54am UTC](https://forum.kirupa.com/t/menu-using-array/253202/1 "2008-02-28T02:54:14Z")

</div>

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?
