# How to optimize an AS3 menu

**URL:** <https://forum.kirupa.com/t/how-to-optimize-an-as3-menu/303341>\
**Category:** flash\
**Created:** [January 19, 2010, 12:14am UTC](https://forum.kirupa.com/t/how-to-optimize-an-as3-menu/303341 "2010-01-19T00:14:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![felipegm](https://avatars.discourse-cdn.com/v4/letter/f/e9bcb4/32.png) [@felipegm](https://forum.kirupa.com/u/felipegm)\
**Post date:** [January 19, 2010, 12:14am UTC](https://forum.kirupa.com/t/how-to-optimize-an-as3-menu/303341/1 "2010-01-19T00:14:26Z")

</div>

I’m using the code bellow for a menu:

```auto

//button 1
button1.addEventListener(MouseEvent.MOUSE_OVER,over);
button1.addEventListener(MouseEvent.MOUSE_OUT, out);

function over(e:MouseEvent):void{
  TweenLite.to (button1,1,{alpha:0});
 }
function out(e:MouseEvent):void{
  TweenLite.to (button1,1,{alpha:1});
}

```

The problem is that I’ll have several buttons, and I was imagining if there’s a easer, faster and cleaner way of doing the actions, since all the buttons will have the same rollover and rollout effect.

I tried to use

```auto

function over(e:MouseEvent):void{
  TweenLite.to (this,1,{alpha:0});
 }

```

but the effect takes place in all stage elements.  
Is there a way of doing the effect with Vars or another easer way?

thanks in advance.
