Change color on a button to show that it has been selected.

Here's what I would like to do:
1) Button with the instance name of "mc" and the color
#666666
2) MOUSE_OVER color is #CC0033
3) MOUSE_OUT color is #666666 —IF the button has NOT
been clicked.
4) CLICK color is #333333
5) New MOUSE_OUT color is #333333—If the button HAS
been clicked.
6) MOUSE_OVER stays the same.
Here's the problem...
1) How do I make a new MOUSE_OUT color of #333333 (the same
as the CLICK color)—If the button HAS been clicked?
2) How do I maintain the MOUSE_OVER color?
I'm starting to pull out my hair! I appreciate any
help!!!!!!!!!! Do I need if's or else's.
Text
new

You need if's and else's and a variable to judge in that
if... in the MOUSE_OUT handler . The variable should indicate if
the button has been clicked or not and should be set in the CLICK
handler.
var clicked:Boolean = false;
function mcClick(event:MouseEvent):void{
etc...
clicked = true;
function mcMouseOut(event:MouseEvent):void{
var newColorTransform:ColorTransform =
mc.transform.colorTransform;
if(clicked){
newColorTransform.color = 0x333333;
} else {
newColorTransform.color = 0x666666;
mc.transform.colorTransform = newColorTransform;
gotoAndPlay("img1");
}

Similar Messages

Maybe you are looking for