Requirements
- Flash MX or higher.
- PHP enabled server.
Preview
1. Start by creating a 300x300 document in Flash.
2. Select the Text Tool.
3. In the Property Inspector make sure the Text type is set to Static Text.
4. Click near the top left of the Stage and type "Name:".
5. Below that text click and type "E-mail:".
6. Below that text click and type "Comments:".
7. You should have something that looks like the following.
8. In the Property Inspector change the Text type to Input Text.
9. To the right of "Name:" draw an input text box that stretches across the rest of the stage.
10. In the Property Inspector click the Show border around text button and put "tName" for the Instance name.
11. To the right of "E-mail:" draw an input text box that stretches across the rest of the stage.
12. In the Property Inspector make sure the Show border around text button is selected and put "tEmail" for the Instance name.
13. In the Property Inspector change the Line type to Multiline
14. Beneath "Comments:" draw a rectangular input text box that covers the area underneath Comments.
15. In the Property Inspector make sure the Show border around text button is selected and put "tComments" for the Instance name.
16. You should have something that looks like the following.
17. Select the Rectangle Tool.
18. Draw a rectangle in the bottom right corner of the stage.
19. Select the Text Tool.
20. On top of the rectangle you just drew, click and type the word "Submit".
21. You should have something that looks like the following.
22. Select the Selection Tool.
23. Draw a box around the rectangle and "Submit" text to select them both.
24. Press F8 to convert your selection to a symbol.
25. Set the Name to "Submit Button" and set the Type to Button and press OK.
26. Click on the button you just created and in the Property Inspector put "bSubmit" for the Instance name.
27. Click on the first frame in the Timeline and press F9 to open the Actions Panel.
28. Insert the following ActionScript code into the Actions Panel.
|
bSubmit.onRelease = function()
{ email(); } function email() { var sMessage = "Name: " + tName.text + "nE-mail: " + tEmail.text + "nComments: " + tComments.text; lvSend = new LoadVars(); lvReply = new LoadVars(); lvSend.msg = sMessage; lvSend.address = "email@email.com"; //Change this to your e-mail. tName.text = "Sending Message..."; tEmail.text = ""; tComments.text = ""; lvReply.onLoad() { tName.text = "Message Sent"; } lvSend.sendAndLoad('mail.php', lvReply, 'POST'); } |
29. Now open Notepad and paste the following code into it.
|
<?php
$message = $_POST["msg"]; $address = $_POST["address"]; mail($address,"E-mail Form Message",$message); ?> |
30. Choose File > Save as... and save the file as "mail.php" in the same folder as your swf.
31. Upload both files to your server to test.
Tutorial Files (Right click the link and choose save target as...)












