PDA

View Full Version : How to make text color stay when MOUSE_DOWN?


jenniferma
11-25-2008, 10:18 AM
I have this dynamically loaded text fields, I have added listeners to each of them for MOUSE_OVER, MOUSE_OUT and MOUSE_DOWN events. when MOUSE_OVER the text would change color and when MOUSE_OUT it would change back to its original color. What I intend to do is when I click on it, it should change its color and stop respond to MOUSE_OVER and MOUSE_OUT events until I make a click on other text fields and it will come back alive to respond to MOUSE_OVER and MOUSE_OUT events while the other text field later clicked will stop responding to MOUSE_OVER and MOUSE_OUT.
How should I achieve this?
So far I could only make colors change in MOUSE_OVER and MOUSE_OUT events, but could not make the text color to stay unchanged when clicked.
Here's a fraction of my code:
function mouseOverText(e:MouseEvent):void {
trace("mouseOverText: ", e.target);
TextField(e.target).textColor = 0xFF0000;

}

function mouseOutText(e:MouseEvent):void {
trace("mouseOutText: ", e.target);
TextField(e.target).textColor = 0x00FF00;

}

function mouseClickText(e:MouseEvent):void {
TextField(e.target).textColor = 0xFF0000;
trace("mouseClickText", e.target.name);
LoadExternalImage(e.target.name);
}

palmjack
11-25-2008, 11:48 AM
To disable MOUSE_OVER and MOUSE_OUT events you can remove listeners for the TextField that was clicked
You have track which one was clicked in some variable and then reassign listeners again
This post may give you some hints http://www.actionscript.org/forums/showthread.php3?t=187930

EDIT: also check this one http://www.actionscript.org/forums/showthread.php3?t=189162&highlight=button+clicked