Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question Regarding onSetFocus 1

Status
Not open for further replies.

dmears1

Technical User
Jun 18, 2003
208
US
I can't seem to find my problem and any help is greatly appreciated. I have a movie clip with a variable name of "form". Inside the movie clip I have an input textfield with a variable name of "name".
I have initialized the textfield and I want the textfield to clear when the user clicks in the text box. I thought the following actionscript would do this:

form.name = "Enter Your Name";
form.name.onSetFocus = function() {
form.name = "";
}
This script is currently on the first frame of the movie.
When the movie loads the textfield contains "Enter Your Name", but when I click in that field it is not cleared.
Any ideas on what my problem could be?
Thanks in advance for any help.
 
Use an instance name on the textfield instead...

form.nameField.text = "Enter Your Name";
form.nameField.onSetFocus = function() {
form.nameField.text = "";
}
 
Thanks for the reply OldNewbie...That was the way I tried it the first time & I got the same results. Hmmmmm...Any other suggestions?
 
I'm officially a moron...After a good nights sleep, I take a fresh look at the script and immediately see my problem. A dumb typo was all that was wrong.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top