Flashvault.net

Contact Flash Form

14.12.2006, 17:5    Total views: 67280

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

Convert FLV to iPod MP4 Video
Last post by: linddy
Date: 04.12.2008 10:40:59

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

Convert AVI Video to Flash
Last post by: linddy
Date: 29.11.2008 04:40:55

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

For Sale Brand NewHTC Touch HD $380Samsung i900 Om
Last post by: so100
Date: 25.11.2008 13:01:33

For Sale Brand NewHTC Touch HD $380Samsung i900 Om
Last post by: so100
Date: 25.11.2008 13:00:48

Waiting for your hour of triumph? It is near!
Last post by: VitaMary
Date: 21.11.2008 18:46:41

Yeow dogs!
Last post by: deco11
Date: 21.11.2008 01:15:49

Show your girlfriend what a real sex is!
Last post by: VitaMary
Date: 20.11.2008 22:00:13

Related links