Flashvault.net

Contact Flash Form

14.12.2006, 17:5    Total views: 69366

In this tutorial we will show you how to create contact form in flash. Macromedia Flash can not send e-mail by him self so we must use a little of php programming.

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!

Forum - Newest Discussions

Contact Flash Form
Last post by: chau pham
Date: 07.01.2009 04:54:11

Flash Menu Sound
Last post by: totoxo
Date: 07.01.2009 03:22:42

Interactivity with mouse coordinates
Last post by: flip76
Date: 29.12.2008 19:14:53

Interactivity with mouse coordinates
Last post by: flip76
Date: 29.12.2008 18:27:44

Hi everybody
Last post by: Admin
Date: 22.12.2008 12:15:28

How do I combine images with text simultanuelsy?
Last post by: speedyj
Date: 03.12.2008 23:10:49

photogallery
Last post by: trnghosn
Date: 26.11.2008 16:22:19

Regarding the Gradient by Mouse Tutorial...
Last post by: cloudy-days
Date: 19.11.2008 07:41:03

Open flash cs3 fla in flash 8???
Last post by: benjezza
Date: 14.11.2008 23:41:46

Related links