I have experienced the pain of trying to find out HOW TO MAKE A MAILFORM in flash so once i figured it
out I thought I’d share it with you all.
1). Open a new file and have one layer with two keyframes
2). Put a stop() action in each of them buy *right-clicking on the keyframe, selecting actions and
choosing ‘stop()’ from the basic actions list*
3). Now drag and drop all the text sections that you want into the first keyframe. Make sure that the
text fields that you expect the user to fill in are changed to input text found in the
properties box.
4). Create 2 buttons. Call one send and the other clear.
5). Still in keyframe 1 put the variable in each ‘input text’ selection. NOT THE INSTANCE NAME!! If it
is a name that you are getting, make it easy and type ‘name’ (without the quotes) in the VARIABLE box
in the property section. (you might have name/phone/email/comment)
6). Click on the ‘clear’ button and put the following in the ‘actions’ section
on (release) {
name = "";
phone ="";
email ="";
comment ="";
}
This tells the variables to clear if the button is pressed.
7). Then click on the ‘send’ button and put the following in the code:
on (release) {
if (name eq "" or phone eq "" or email eq "" or comment eq "") {
stop ();
} else {
loadVariablesNum ("form.php", 0, "POST");
gotoAndStop (2);
}
}
This will make sure all fields are filled out before the user can click send. If you dont need certain
areas filled out then just remove it from the code. Erase from the ‘or’ to the “” . Then you’ll notice
that it tells it to send the information to ‘form.php’. We will make that now.
8).Open notepad and enter
<?PHP
$to = "[email protected]";
$msg = "$name
";
$msg .= "$phone
";
$msg .= "$email
";
$msg .= "$comment
";
mail($to, $subject, $msg, "From: My web site
Reply-To: $email
");
?>
Replace the email with your own and then add all of the variables you’ve used. When you use multiple
variables you have to use “.=” as shown above in the code. The
is just like a br in html.
It starts a new line. Make sure to have the ; as they show there is more code to come.
9).Now save this file as form.php (You’ll have to type in the extension or it will just save as txt.
10). Go to keyframe 2 and enter whatever confirmation text you want the user to see upon submiting his request.
- Upload the .swf and the .php to your server and there you are…a mailing form ready for your
visitors.
Happy Mailing All.
:love: