Archive

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();
  3.  
  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!";
  13.  
  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;
  27.  
  28. // Layout settings
  29. contactForm.nameWidth = 400;
  30. contactForm.emailWidth = 400;
  31. contactForm.messageWidth = 550;
  32. contactForm.messageHeight = 200;
  33. contactForm.verticalSpacing = 10;
  34.  
  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!

__

Free AS3 Scrollbar: Fullscreen and Resizable

In coincidence with the launch of my new Aspen template, I’ve decided to release for free the source code for the scrollbar I’ve been using in my other Flash templates. The scrollbar is coded in AS3 and will automatically resize according to the amount of content, unlike a lot of other Flash scrollbars. You can set the track color, grabber color, grabber press color, grip color, track thickness, grabber thickness, ease amount and whether or not the grabber is “shiny”.

Update [6-21-2009]: Now supports mouse wheel scrolling on the Mac using SWFWheel.

Here is a demo of the scrollbar in use. You can click “Add Copy” to see how it resizes:

Get Adobe Flash player

You can also view a demo of it being used fullscreen in my Sycamore template.

Here is the usage for the scrollbar class:

// Arguments: Content to scroll, track color, grabber color, grabber press color, grip color, track thickness, grabber thickness, ease amount, whether grabber is “shiny”
  1. _scrollBar = new FullScreenScrollBar(_content, 0×222222, 0xff4400, 0x05b59a, 0xffffff, 15, 15, 4, true);
  2. addChild(_scrollBar);

ยป Download the demo and source code

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

Enjoy!

Simple Sanity-Saving Tip for All Timeline-Based Flash Projects

Here is a simple code snippet to use with any timeline-based Flash project that will save you from pulling your hair out. If you are like me you still occasionally find yourself doing Flash projects that are strictly timeline-based. No matter how much you love doing class-based AS projects, there are certain projects that just make sense to do with the timeline. Think banner ad animations and linear “Flash commercial” type projects, where it’s just two minutes straight of animation.

Continue reading ‘Simple Sanity-Saving Tip for All Timeline-Based Flash Projects’

21 Well-Designed Flash Portfolios

Even though I make my living designing and developing Flash sites, I have to admit I usually start to cringe whenever I see a Flash loading bar. It’s not that Flash is a bad technology, it’s just that unfortunately there tends to be a lot of poorly designed sites out there with a total disregard for the user experience. When done right though, Flash sites can be both beautiful and usable.

Continue reading ’21 Well-Designed Flash Portfolios’

AS3 Dotted Line Class

Here is an ActionScript 3 class I use all the time to draw pixel perfect dotted lines in Flash. You can set the line width, line height, color, alpha, dot width, and dot spacing. Simple but useful!

Continue reading ‘AS3 Dotted Line Class’