Our Flash tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website.  Home Flash & Swish Flash Tutorials Macromedia Flash Email Actionscript Validation

Macromedia Flash Email Actionscript Validation


A form is a section of web document where users can enter data before submitting for processing. Usually, forms are misused by users if no proper validation control is in place. To prevent such abuse from happening one can make use the power of javascript to validate the form before sending it to the server.

Form in flash mx requires validation control as well. The good news is that it can be done using actionscript alone and this flash tutorial guide will show you how.

Here is what you are going to build today

To begin with, please download the partially done source code. This source code only contains the interface and I'll walk you through the process of making the flash email validation control works.

I assume you have downloaded the flash source code above and ready to begin.

1. Observe that we have 4 layers. The top layer name 'action' is what important to us and we are going to type in our flash actionscript there.

image 1

2. We have one input text box for user to type in and we give it an instance name 'email'.

image 2

3. Another dynamic text box for displaying the status of the validation and we name it 'message'.

image 3

4. On the bottom of the working space we have a button instance named 'validate_btn'.

Macromedia Flash Email Actionscript Validation

5. Okay, let's insert the real action into the action layer. First open up the first frame on the action layer and paste these codes into the action panel.

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";
}
}

6. Don't worry about the syntax first, just go on and test the movie by pressing 'CTRL+ENTER'.

Bingo!! You have just created an email validation control purely on actionscript!

And here is the full source code.



Author's URL: CambodiaXP.com
Final results of our readers
New!
Passed through all the steps? Share your result!
Your result will be premoderated.
Please make sure you choose the right image.
 
 



Captcha

*Required fileds
Our Flash tutorials provide you with step-by-step instructions on how to create beautiful Flash animations and integrate them into your website. More Flash Tutorials: Featured Materials | Fresh Materials | More Flash Tutorials at FlashPerfection.com

Reader's comments
comments ganesh September 09, 2011 says:
hi, moderator can you please remove my id from the post dated
ganesh September 29, 2010 says:
thanks to all the team members, I have a basic animation tutorial, can i post it here, my id is ganesh.guwahati@gmail.com

OR you can delete the complete post

Reply
comments ganesh September 29, 2010 says:
thanks to all the team members, I have a basic animation tutorial, can i post it here, my id is ganesh.guwahati@gmail.com
Reply
Add comments to "Macromedia Flash Email Actionscript Validation"

Captcha