Trouble validating input text

Hi all. Just wondering if anyone can help. I’m trying to validate a text input field for email address only if there is actual text inserted. If the input is left blank then the playhead goes to the “end” frame. If there is an error in the text such as no @ symbol , then the playhead goes to the “error” frame. the problem is that when I enter a valid email, my send button doesn’t do anything at all, it seems to become inactive. I can’t figure out what the problem is in my code. Could someone help me out? send_pb is my button. Here’s my code Try it for yourself if you want. 3 frames, an input text and button on frame1, frame2 labeled error, frame3 labeled end.

send_pb.addEventListener(“click”, sendListener);
function sendListener(event:Event) {
if(email.text != “”) {
if (email.text.indexOf("@") < 1
|| email.text.indexOf("@") == email.text.length -1
|| email.text.indexOf("@") !== email.text.lastIndexOf("@")) {
gotoAndStop(“error”)
}
} else {
gotoAndStop(“end”);

}
}