Click here to view Preview
The code is quite small and easy to understand.
var startingText = "Enter your text here!";
name_txt.text = startingText;
name_txt.addEventListener(FocusEvent.FOCUS_IN, checkTheText);
function checkTheText(event:FocusEvent):void{
if(name_txt.text == startingText){
name_txt.text="";
}
}
First we enter the default text we want to show, then apply it
to our text field (in this example - an input field with
instance "name_txt"). When the user focuses on the text field,
the default text dissapears.
Download .zip
No comments:
Post a Comment