Monday, February 16, 2009

How to create a Contact Flash Form

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:

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!

1 comments:

June Mark D. Montanez | May 20, 2010 at 8:21 PM  

Thanks for sharing this. Good Job, I try to do this.

Post a Comment