I have a doubt in flash AS3, my requirement is how to place a watermark in Flash Input text field so that if any user clicks on the input text field then the text which was already appearing should not be visible . I hope that i will get a better answers from anyone of you Thanks --Jennifer.
Asked
Active
Viewed 1,546 times
3 Answers
1
The term you're actually looking for is called cuebanner, not watermark. I'm not familiar with Flash, so I can't tell you how to do it. But if you Google cuebanner, you may get better information than when googling for watermark.

dustyburwell
- 5,755
- 2
- 27
- 34
1
yes you can do that like this create a text file enter the text addEventListener that listen to the CLICK of the user and in the function clear the content of the text Field
txt = new TextField();
txt.text = "clikc me";
txt.addEventListener(MouseEvent.CLICK,onTxtClick);
this.addChild(txt);
// the Listen function
private function onTxtClick(evt:MouseEvent):void
{
txt.text = "";
}

Shvilam
- 236
- 4
- 11
- 27
1
To improve slightly what Shvilam wrote:
public static const PROMPT:String = "Type your text here...";
public static const PROMPT_COLOR:Number = 0x999999;
txt = new TextField();
txt.text = PROMPT;
txt.textColor = PROMPT_COLOR;
txt.addEventListener(FocusEvent.FOCUS_IN, focusHandler);
txt.addEventListener(FocusEvent.FOCUS_OUT, focusHandler);
this.addChild(txt);
// the Listen function
private function focusHandler(event:FocusEvent):void
{
switch (event.type) {
case FocusEvent.FOCUS_IN:
if (txt.text == PROMPT) {
txt.text = "";
txt.textColor = 0xFFFFFF;
}
break;
case FocusEvent.FOCUS_OUT:
if (txt.text == "") {
txt.text = PROMPT;
txt.textColor = PROMPT_COLOR;
}
break;
}
(Untested.)

David Hanak
- 10,754
- 3
- 31
- 39