# Flash menu & button listeners

**URL:** <https://forum.kirupa.com/t/flash-menu-button-listeners/242665>\
**Category:** Uncategorized\
**Created:** [October 29, 2007, 10:29am UTC](https://forum.kirupa.com/t/flash-menu-button-listeners/242665 "2007-10-29T10:29:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Binji](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@Binji](https://forum.kirupa.com/u/Binji)\
**Post date:** [October 29, 2007, 10:29am UTC](https://forum.kirupa.com/t/flash-menu-button-listeners/242665/1 "2007-10-29T10:29:00Z")

</div>

So i have a menu with buttons, which are actually a single mc, of which i have multiple instances on the stage and i change their text on startup via AS. I also have rollover, rollout and of course onrelease events. Rollover and rollout are the same for all elements so if i include them as a part of the element MC it works without problem. But that occurs when implementing onrelease event to open a new page.  
I cant put it into the mc because it opens different pages (or is there a way?) and if i try to define it in \_root the other 2 events dont work anymore. The only solution i found so far is defining events for each of the elements like this:

```auto

this.m0.onRelease = function(){
    getURL("index.php?p=0", "_self");
};

this.m0.onRollOver = function(){
    showSparkles(m0);
};
this.m0.onRollOut = function(){
    endSparkles();
};

```

but im sure theres a better way (in a loop for example) to do this. If i do try putting it in a loop i cant (well… dont know how:azn:) getting the current rolledover element to the showSparkles function.  
Any help please?
