Home  |  Free Templates (NEW)  |  Premium Website Templates  |  Tutorials  |  Privacy Policy  |  Link Exchange  |  Contact Us
Tutorials
Photoshop Tutorials
Flash Tutorials
3D Graphics Tutorials
Partners
Free Website Templates
Flash Templates Today
Web Sites
Free Shape
Photoshop Tutorials
Flash Tutorials
Illustrator Tutorials
HTML Tutorials
Flash Templates
Free Web Templates
Free Flash Templates
Web Templates Forum
Recommended Hosting:
Host Unlimited Domains on 1 Account
1500GB storage and 15000GB bandwidth for $6.95/mo!
Recommended Hosting:
Host Unlimited Domains on 1 Account
1500GB storage and 15000GB bandwidth for $6.95/mo!
Free Website Templates: 123456789101112131415
Preview & Download Preview & Download Preview & Download

Welcome To NewFreeTemplates.com Flash Tutorials Area - Forms: Create, validate and send by email

Create dynamic text fields in Flash and send them by email . Minimum Flash Designer version 5.0.22.

  1. Create a new document and set the size to 400 x 300 ("Frame" > "Frame Size")
  2. Set "Frame 1" to "Stop" ("Frame" > "Frame Delay" and check "Stop", click OK)
  3. Draw 2 edit fields with the "Edit field" tool, they will appear as Edit1 and Edit2. Double click each field and make sure HTML is not checked, uncheck if necessary.
  4. Draw a button, double-click it and rename it to "OK".
  5. Draw edit field labels "Phone" and "Email" with the text tool. Double click each field and make sure HTML is not checked, uncheck if necessary.
  6. Draw "ErrorMessage" field with the text tool. Choose "Item" > "Text COlor" and change it to red.

  7. Select the button, choose "Item" > "Actions" > "OnClick". Select "ActionScript" and paste the following code:

    // reset error message
    ErrorMessage = ""; 
    
    // validate phone field
    phone = Edit1;
    if(phone=="") ErrorMessage = "Enter your phone";
    
    // validate email field
    email = Edit2;
    if(email=="") ErrorMessage = "Enter your email";
    if(email.indexOf("@",0)<0) ErrorMessage = "Enter valid email";
    if(email.indexOf(".",0)<0) ErrorMessage = "Enter valid email";
    
    // build message string
    message = "mailto:support@selteco.com?subject=Title&body=Form contents%0A";
    message = message + "phone: " + phone + "%0A";
    message = message + "email: " + email;
    
    // execute form if errormessage is empty
    if(ErrorMessage=="") getURL(message,"_self");
    

Hit F9 to preview. The form will not work until you export Flash file and HTML page. Choose "File" > "Export HTML Page" to create HTML page and test the form in a browser.

This form is using very basic validation. Use "%0A" as line separator.

Use the following functions or attributes of the string:

  • length returns the number of characters
  • charAt(x) returns zero-based character at position x
  • indexOf(substring,startindex) returns the position of the first occurrence of the specified substring or -1.
  • lastIndexOf(substring,startindex) returns the position of the last occurrence of the specified substring or -1.
  • substr(start,n) returns n characters string starting at specified position
  • toLowerCase(), toUpperCase() converts the string to lower or upper case

Download source project t1043.zip (1 kb)

Advertisements
 
Home  |  Free Templates  |  Premium Website Templates  |  Tutorials  |  Privacy Policy  |  Contact Us
All Rights Reserved 2007-2008 by NewFreeTemplates.com