Clear text field when clicked

Hi

I have a code that clear textfield when you click inside. My problem is that I have to many text fields so i am trying to write some function that can be used for all the text fields.

What I can’t do is to add some other property to the textfield like I can do with any variable. So my code is:

// nome is a textField
var nome:TextField;
nome.text = “olá” // text displayed inside the text field
var nomePreText = “olá”;

function clearTextField(e:Event) {
if (e.currentTarget.text == e.currentTarget.name+“PreText”) {
trace(e.currentTarget.name+“PreText”); // this trace nomePreText
e.currentTarget.text = “”;
} else {
trace(e.currentTarget.name+“PreText”);
trace(“campo já foi preenchido”);
}
}

nome.addEventListener(“focusIn”,clearTextField);

This is not working. If someone can give me a hint i’ll appreciate :slight_smile: