views:

70

answers:

2

Hello.

The theme question sais it all.

I have an input text-field on the stage that has some text describing text in it before the user types anything. Now, how do I clear this text when the user focuses on (clicks) the field?

+2  A: 

Listen for the FocusEvent.FOCUS_IN event on your textfield and clear it once that fires. http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/events/FocusEvent.html

grapefrukt
A: 

This should do it. (Although, my AS3 is a bit rusty.)

textbox.addEventListener(FocusEvent.FOCUS_IN, clearBox);

function clearBox(e:FocusEvent){
  textbox.setText("");
}
Moshe