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.
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