# How to onRollover several buttons using array?

**URL:** https://forum.kirupa.com/t/how-to-onrollover-several-buttons-using-array/253611
**Category:** Uncategorized
**Created:** [March 3, 2008, 3:08pm UTC](https://forum.kirupa.com/t/how-to-onrollover-several-buttons-using-array/253611 "2008-03-03T15:08:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Brother\_Gabriel](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/brother_gabriel/32/3665_2.png) [@Brother\_Gabriel](https://forum.kirupa.com/u/Brother_Gabriel)
#### Post date: [March 3, 2008, 3:08pm UTC](https://forum.kirupa.com/t/how-to-onrollover-several-buttons-using-array/253611/1 "2008-03-03T15:08:47Z")

</div>

Hello all!

I have a hundred buttons on the screen. I also have an array containing a list of all 100 buttons.

Now, I want to use the same onRollOver method for every button. I DON’T want to program each button separately.

I am thinking something along these lines:  
myArray = new Array

myArray[0] = button1  
myArray[1] = button2  
myArray[2] = button3 etc up to myArray[99] = button100  
then:  
allButtons = myArray[index]

allButtons.onRollOver = function() {  
myonRollOverFunction(); };

Can I do this using an array? I’ve tried, but I don’t know arrays well enough to figure it out.

God bless you if you can help me!  
-Brother Gabriel-Marie
