I’m new to FLASH and I need to validate an email address in a form.
my code is:
validate_btn.onRelease = function() {
indexOfAt = email.text.indexOf("@");
lastIndexOfDot = email.text.lastIndexOf(".");
if (indexOfAt !=-1 && lastIndexOfDot !=-1){
if (lastIndexOfDot <indexOfAt) {
message.text="please verify your email.";
}else {
message.text="Your email seems okay";
}
} else {
message.text="please enter correct email address";
}
}
It seems to work fine the only problem is that follow email is accepted: myEmail@domain. and @domain.com does anyone can help me fix it? take into consideration that is it AS2 so I can’t use RegExp.
Thanks and sorry for my bad English.
You also have to test for
and
Please note that this is a trial, code is UNTESTED