You have two alone-standing "else" in this function, which gives you the error. You can have many "else if" statements but only one "else" statement. Also the if statements all belong together.
Change to something like this:PHP Code:function focusInHandler(e:FocusEvent):void {
if (e.currentTarget.name == "nameField") {
if (e.currentTarget.text == defaultNameEntry) {
e.currentTarget.text = "";
}
} else {
if (e.currentTarget.text == defaultEmailEntry) {
e.currentTarget.text = "";
}
} else {
if (e.currentTarget.text == defaultEnquiryEntry) {
e.currentTarget.text = "";
}
}
}
PHP Code:function focusInHandler(e:FocusEvent):void
{
if (e.currentTarget.name == "nameField")
{
if (e.currentTarget.text == defaultNameEntry)
{
e.currentTarget.text = "";
}
else if (e.currentTarget.text == defaultEmailEntry)
{
e.currentTarget.text = "";
}
else if (e.currentTarget.text == defaultEnquiryEntry)
{
e.currentTarget.text = "";
}
else
{
trace("none of the entries was found");
}
}
else
{
trace("Target is not nameField.");
}
}




Reply With Quote
