Check if Email is valid (check for @ symbol) in flash's email input box

Hi

i have a email input box in my flash form. How can i check for the @ sign in this input box before i allow the user to submit?

right now i cant figure how to write this....of coz this doesnt work but can anyone tell me how should i write this?
on (press)
{
if (Email != "@")
 { Status = "please enter a valid email address";
 } else {
     _root.gotoAndPlay ("submit");
}


tariezAsked:
Who is Participating?
 
CyanBlueConnect With a Mentor Commented:
Howdy...  :)

You could try this...  :)

on (press)
{
      trace("Email = " + Email);
      trace("Email.indexOf(\"@\") = " + Email.indexOf("@"));
      
      if (Email.indexOf("@") < 0)
      {
            Status = "please enter a valid email address";
      }
      else
      {
            _root.gotoAndPlay("submit");
      }
}
0
 
tariezAuthor Commented:
Hi yah it works! thanks

i am looking at some flash dictionary, but wonder if u can help me abit more here,  wat's "indexOf"?


0
 
CyanBlueCommented:
Basically indexOf() function looks for the specified character, @ in this case, and returns the location of that character if found, and returns -1 if @ is not found...  That's what I am checking with '< 0'...  ;)
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

 
sokhodomCommented:
tariez,

It's late here. but here is a link to the flash email validtion: http://www.cambodiaxp.com/tutorial/flash-advance/email-validator/email-validation.php

Cheers,
0
 
tariezAuthor Commented:
Hi yup got my answers. thanks!

and sokhodom. yup that url was helpful too. thanks!

0
 
sokhodomCommented:
no problem m8 :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.