# RollOver and RollOut effect in buttons, with disable to false and keep state

**URL:** https://forum.kirupa.com/t/rollover-and-rollout-effect-in-buttons-with-disable-to-false-and-keep-state/303674
**Category:** flash
**Created:** [January 24, 2010, 10:54pm UTC](https://forum.kirupa.com/t/rollover-and-rollout-effect-in-buttons-with-disable-to-false-and-keep-state/303674 "2010-01-24T22:54:22Z")
**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 24, 2010, 10:54pm UTC](https://forum.kirupa.com/t/rollover-and-rollout-effect-in-buttons-with-disable-to-false-and-keep-state/303674/1 "2010-01-24T22:54:22Z")

</div>

I’m using the code bellow to change the color of button on rollover and rollout. Tried to disable the button using mouseEnabled = false, but when rollout, the button changes color, instead of keeping it’s rollover state.

```auto

stop();

	import com.greensock.*;
import com.greensock.easing.*;
//leave button1 as clicked when starting the movie.
button1.mouseEnabled = false;
TweenLite.to(button1,0,{tint:0x023865})

button1.addEventListener(MouseEvent.MOUSE_UP, clickEffect);
button1.addEventListener(MouseEvent.ROLL_OVER, rolloverEffect);
button1.addEventListener(MouseEvent.ROLL_OUT, rolloutEffect);

button2.addEventListener(MouseEvent.MOUSE_UP, clickEffect);
button2.addEventListener(MouseEvent.ROLL_OVER, rolloverEffect);
button2.addEventListener(MouseEvent.ROLL_OUT, rolloutEffect);

function clickEffect(e:MouseEvent):void {
//trying to disable the clkicked button, so when rollout, dont change color to null
	e.currentTarget.mouseEnabled = false;

	
}
function rolloverEffect(e:MouseEvent):void{
	
	TweenLite.to(e.currentTarget,1,{tint:0x023865, ease:Strong.easeOut});
	
}
function rolloutEffect(e:MouseEvent):void{
	
	//should change tint to null just when its enabled, but its changing always (enabled or disabled)
	TweenLite.to(e.currentTarget,2,{tint:null , ease:Strong.easeOut});
	
}

```

in short, when a button is rollover, it has to change its tint to “blue”, when rollout, change to “null”, when clicked should remain in “blue state”, and restore the previous clicked button to “null state color”.

How can I achieve this?

thanks
