Tag Archive for 'php'

Flash AS3 Contact Form Using PHP

To continue in the tradition of my AS3 scrollbar source code I released a few months back, I’m now giving away the source code for my AS3 contact form class I’ve been using in my other Flash templates, specifically the one from Cedar.

The contact form class is super-customizable and simple to use. I’ve used it in lots of projects and it’s easy to make it look different every time. Here is the basic usage:

  1. import com.warmforestflash.ContactForm;
  2. var contactForm:ContactForm = new ContactForm();
  3. addChild(contactForm);

And here is a preview:

Get Adobe Flash player

Pretty much everything can be easily customized including all the colors and text and validation copy. Here is how you would customize it:

  1. import com.warmforestflash.ContactForm;
  2. var contactForm:ContactForm = new ContactForm();
  4. // Label settings
  5. contactForm.nameText = "Type your name here";
  6. contactForm.emailText = "Type your email here";
  7. contactForm.messageText = "Type your message here";
  8. contactForm.sendButtonText = "CONTACT ME";
  9. contactForm.sendingText = "Sending message…";
  10. contactForm.errorEmailText = "Your email is not valid.";
  11. contactForm.errorServerText = "Server problems.";
  12. contactForm.confirmationText = "Thanks for contacting me!";
  14. // Color settings
  15. contactForm.textColor = 0xffffff;
  16. contactForm.borderColor = 0×222222;
  17. contactForm.backgroundColor = 0×000000;
  18. contactForm.selectedBorderColor = 0x05b59a;
  19. contactForm.selectedBackgroundColor = 0×000000;
  20. contactForm.selectedBlurAmount = 50;
  21. contactForm.sendButtonTextColor = 0xffffff;
  22. contactForm.sendButtonTextRollOverColor = 0xffffff;
  23. contactForm.sendButtonColor = 0x05b59a;
  24. contactForm.sendButtonRollOverColor = 0xff4400;
  25. contactForm.errorColor = 0xff4400;
  26. contactForm.confirmationColor = 0x05b59a;
  28. // Layout settings
  29. contactForm.nameWidth = 400;
  30. contactForm.emailWidth = 400;
  31. contactForm.messageWidth = 550;
  32. contactForm.messageHeight = 200;
  33. contactForm.verticalSpacing = 10;
  35. addChild(contactForm);

And here it is customized:

Get Adobe Flash player

I’m also including an XML-powered version for people who don’t own the Flash authoring software or who don’t know any ActionScript at all. You can just drop this into an HTML page and customize everything straight through the XML without having to open Flash or mess with any ActionScript. It’s a simple way to add a contact form to any website.

The script that actually sends the email is written in PHP so the web server you upload it to will need to support PHP in order for the email to send.

» Download the contact form class and XML version

Feel free to use this code in any way you want other than selling it.

Have fun!