# Enabling / disabling buttons in AS3

**URL:** <https://forum.kirupa.com/t/enabling-disabling-buttons-in-as3/269156>\
**Category:** Uncategorized\
**Created:** [August 23, 2008, 1:18pm UTC](https://forum.kirupa.com/t/enabling-disabling-buttons-in-as3/269156 "2008-08-23T13:18:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Typezero](https://avatars.discourse-cdn.com/v4/letter/t/f6c823/32.png) [@Typezero](https://forum.kirupa.com/u/Typezero)\
**Post date:** [August 23, 2008, 1:18pm UTC](https://forum.kirupa.com/t/enabling-disabling-buttons-in-as3/269156/1 "2008-08-23T13:18:01Z")

</div>

Hi all - i’m making the jump to AS3 & AS3 Tween engines - TweenMax in particular -  
I’m making a nav system that has tweens for the OVER , OUT & CLICK states - and then  
disabling the button once clicked…this is something i used to do in AS2 & MCTween all the time but in AS3 i’m having trouble…

I’ve created some buttons that tint between different states - all over , out  
& click states tween fine , but when trying to enable & disable the buttons it seems  
to run the tween for “CLICK” & then re-run the “OVER” tween - indeed it looks like the MOUSE\_OVER event is getting retriggered after the CLICK event.

Any way round this?

Any help greatly appreciated ,  
Big thanks 🙂

```auto
import gs.TweenMax;
import fl.motion.easing.*;

/////////////////////////////////////////////////////////////////////
   
var speed:Number = 1;
var motion:Function = Back.easeOut;

var colourOver:String = "0XFF9900";
var colourOut:String = "0X3399FF";
var colourRelease:String = "0XFF3366";

box1.buttonMode = true;
box2.buttonMode = true;
box3.buttonMode = true;

/////////////////////////////////////////////////////////////////////
   
function buttonOver(evt:Event){
TweenMax.to(evt.target , speed , {tint:colourOver , ease:motion});
   }   
   
function buttonOut(evt:Event){
TweenMax.to(evt.target , speed , {tint:colourOut , ease:motion});
   }
   
/////////////////////////////////////////////////////////////////////
   
      function button1Release(evt:Event){
TweenMax.to(evt.target , speed , {tint:colourRelease , ease:motion});
evt.target.mouseEnabled = false;
box2.mouseEnabled = true;
box3.mouseEnabled = true;
   }
   
      function button2Release(evt:Event){
TweenMax.to(evt.target , speed , {tint:colourRelease , ease:motion});
evt.target.mouseEnabled = false;
box1.mouseEnabled = true;
box3.mouseEnabled = true;
   }
   
      function button3Release(evt:Event){
TweenMax.to(evt.target , speed , {tint:colourRelease , ease:motion});
evt.target.mouseEnabled = false;
box1.mouseEnabled = true;
box2.mouseEnabled = true;
   }
   
/////////////////////////////////////////////////////////////////////
   
box1.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
box1.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);
box1.addEventListener(MouseEvent.CLICK, button1Release);
   
box2.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
box2.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);
box2.addEventListener(MouseEvent.CLICK, button2Release);
   
box3.addEventListener(MouseEvent.MOUSE_OVER, buttonOver);
box3.addEventListener(MouseEvent.MOUSE_OUT, buttonOut);
box3.addEventListener(MouseEvent.CLICK, button3Release);
   
/////////////////////////////////////////////////////////////////////

```
