Flash tutorials
Home 3D (2) Actionscripting (66) Animation (100) Audio (4) Drawing (7) Full flash sites (4) Getting Started (15) Navigation (25) Special Effects (54) Text Effects (38)

Contact Flash Form

14.12.2006, 17:5    Total views: 107025

In this thoroughly explained, detailed lesson, I will show you how to create contact form in flash. To make this lesson, you have to use Action Script code and a little of php programming. Let's start!


Step 1

Open a new document in flash. Set the document dimensions what ever you like. Select first frame in the time line open the Action Script Panel (F9), and paste this script:

stop();

Step 2

Select the second frame and insert keyframe and in the script paste this:

stop();

Step 3

Select the Text Tool in the left dialog box or just press „T“ key. Set the text tool properties to values lilke this :



Step 4

Make 4 of input text fields like it is shown in picture below:



Note: for the second input field set the „var“ value to „subject“, for the third set „var“ „message“ and for the fourth „email“

Step 5

Write the field names like this: (you can just write it)



Step 6

Now  make,in the same layer, in the same frame, 2 buttons like in the picture above. Select the send button and press F9 and add this script :

on (release) {
         if (name eq "" or subject eq "" or message eq "" or email eq "") {
               stop();
         } else {
         loadVariablesNum("form.php", 0, "POST");
         gotoAndStop(2);
     }
}

Now select the clear button and press F9 and add this script inside :

on (release) {
    name = "";
    subject="";
    message="";
    email="";
}

Step 7

Now select second frame in the timeline, and in the middle of stage write „Thanks, mail sent“
Save the file and name it form.fla and Go to File->Export and export the movie form.swf

Step 8

Open Macromedia Dreamweaver or any text editor (notepad).
Open a new file, name it form.php and write folowing code:

 
   $to = "your_email@email.com";
   $msg = "$name\n\n";
   $msg .= "$message\n\n";

  mail($to, $subject, $msg, "Message From: Online client\nReply-To: $email\n");

?>

Step 9

Save the file as form.php. Make sure that you saved your php file in the same folder as your form.swf file.

We're done!

Have questions about this tutorial?
Visit our friendly Community Forums!
Digg it! Add this tutorial to del.icio.us! Furl it! Add this tutorial to reddit! Spurl it! Add this tutorial to technorati!

Top tutorials

1. Advanced full flash site - Part 1
Total views: 225065

2. Water effect
Total views: 169137

3. Photo slide show
Total views: 156961

4. High-tech city animation
Total views: 154359

5. Special Picture Effect
Total views: 148419

Related links