# How to set an action for multiple objects

**URL:** <https://forum.kirupa.com/t/how-to-set-an-action-for-multiple-objects/288750>\
**Category:** Uncategorized\
**Created:** [May 20, 2009, 3:36pm UTC](https://forum.kirupa.com/t/how-to-set-an-action-for-multiple-objects/288750 "2009-05-20T15:36:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcelomdsc](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@marcelomdsc](https://forum.kirupa.com/u/marcelomdsc)\
**Post date:** [May 20, 2009, 3:36pm UTC](https://forum.kirupa.com/t/how-to-set-an-action-for-multiple-objects/288750/1 "2009-05-20T15:36:26Z")

</div>

Hello, I would like to know how could I set an action for an entire set of buttons.  
I have the following code…

//hide & show noticias  
hideNoticias.onRollOver = function(){  
noticias.\_visible = false;  
};  
hideNoticias.onRollOut = function(){  
noticias.\_visible = true;  
};

//menu

//ginkgo  
menu\_ginkgo.onRelease = function(){  
loadMovie(“data/swf/ginkgo.swf”, “\_level1”);  
};

//marcas  
menu\_marcas.onRelease = function(){  
loadMovie(“data/swf/marcas.swf”, “\_level2”);  
};

my menu has many more buttons: menu\_premios, menu\_via, menu\_prensa, etc.  
So what I want to do is to set the action…

hideNoticias.onRollOver = function(){  
noticias.\_visible = false;  
};  
hideNoticias.onRollOut = function(){  
noticias.\_visible = true;  
};

for all of the menu items with out having to duplicate the code for each one.

Is there a way?

Flash CS3 / AS 2

thanks!!!
