# Control mouse events on all buttons

**URL:** <https://forum.kirupa.com/t/control-mouse-events-on-all-buttons/258342>\
**Category:** Uncategorized\
**Created:** [April 23, 2008, 8:21am UTC](https://forum.kirupa.com/t/control-mouse-events-on-all-buttons/258342 "2008-04-23T08:21:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pier25](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pier25](https://forum.kirupa.com/u/Pier25)\
**Post date:** [April 23, 2008, 8:21am UTC](https://forum.kirupa.com/t/control-mouse-events-on-all-buttons/258342/1 "2008-04-23T08:21:52Z")

</div>

What I make usually is have an array and set different levels of mouse blocking.

Example:

I have the menu, the contents, and lets say something else that appears on top of everything called animation.

mouse\_block = new array(false,false,false)

The first false corresponds to the menu, the second to the contents, etc.

So, I check on every clickable mc if their level is false or true.

on(press){  
if(mouse\_block[1]){  
//do what ever it is suposed to do  
this.useHandCursor = true;  
} else {  
this.useHandCursor = false;  
}  
}

My problem is that I need to write that on every movieclip…

Can you point me a way of optimizing this?

I thought of using the prototype, but from what I know you can only create new methods an properties.

Is there a way of modifying the mouse events like onPress or onRollOver?.. or create your own mouse events using those as a starting point?

Thanks
