Valid Email in AS3

txt1.text="";
custdetails_btn.addEventListener(MouseEvent.CLICK, popup);
function popup(event:MouseEvent):void {
if( cust_name.text=="" || cust_email.text == "" )
{ txt1.text="Please enter Name and Email";
}

else if(cust_email.text == "" ||
cust_email.text.indexOf("@") < 0 || cust_email.text.indexOf(".") < 0 || cust_email.text.indexOf(" ") > 0 )
{
txt1.text="Please enter valid email";
}
else
{
MovieClip(root).play();
}
}

0 comments:

Post a Comment