PDA

View Full Version : focus problem...



leeharding
July 6th, 2005, 06:59 PM
i am using a simple flash email form with three input areas: name, email and message.

What i have is an empty movie clip with an onClipEvent (mouseUp) action applied to it which removes the text within each text field when it is selected. This is so i can have "name", "email" and "message" written in the input text boxes, which dissapears when the user selects it.

The problem is that if someone puts their text in then reselects it after doing something else, then their text also dissapears... i suppose im looking for a way to remove the focus just once, or another way of removing the focus.

here is the actionscript applied to the empty movieclip:





onClipEvent (mouseUp) {
if (Selection.getFocus() == "_level0.form.nameboxtext") {
_level0..form.name = "";
} else if (Selection.getFocus() == "_level0.form.emailboxtext") {
_level0.form.email = "";
} else if (Selection.getFocus() == "_level0.form.body_txt") {
_level0.form.message = "";
}
}



hope someone can help, thanks in advance,

Lee

Lindquist
July 6th, 2005, 07:23 PM
The simplest way to do this would be to add another check to your if statement. For example, if the Selection.getFocus() is the textField and the textField still has the default text in it, then take out the text.



if (Selection.getFocus() == "_level0.form.nameboxtext" && _level0.form.name == "name"){
_level0.form.name = "";
}


Wash, rinse, repeat (or use arrays and loops) for the desired results on the other fields.

Questions?

leeharding
July 6th, 2005, 07:40 PM
works like a charm, thank you.

Lee

Lindquist
July 6th, 2005, 07:49 PM
glad to be of service