I just added my first code to make a text field appear when a user mouse over it. The code below works perfectly.
My question: What code do I need to add for the same text field to disappear when the user mouse out?
Thanks for your help.
/*Here is my code that works well for mouse_over (now I just need mouse_out)*/
FLags.addEventListener(MouseEvent.MOUSE_OVER, fl_ClickToPosition);
var fl_TF:TextField;
var fl_TextToDisplay:String = "UK or USA english Spelling.";
function fl_ClickToPosition(event:MouseEvent):void
{
fl_TF = new TextField();
fl_TF.autoSize = TextFieldAutoSize.LEFT;
fl_TF.background = true;
fl_TF.border = true;
fl_TF.x = FLags.x;
fl_TF.y = FLags.y + FLags.height + 5;
fl_TF.text = fl_TextToDisplay;
addChild(fl_TF);
}
You'll need to create a listener for a MOUSE_OUT event.
What you might want to do with what you have already is to instantiate the textfield (fl_TF = new TextField();) outside of the function so that you don't end up creating a new one every time you rollover. Then you could reuse the same textfield over and over by having the addChild(fl_TF) in the rollover function and removeChild(fl_TF) in the rollout function
You're welcome.
Button symbols (SimpleButton objects) can serve a purpose and can save you some work when you want a simple appear/disappear hovering effect.
The only question is whether or not you can do it using code... it's a good thing to know how to do, so you oughta give it a try at some point.
North America
Europe, Middle East and Africa
Asia Pacific