This flash contact form is simply made in Adobe Flash CS3 ActionScript 3. Email validation is better than previous version in ActionScript 2. It sends the form field variables to PHP and loads the response variables back to Flash using URLVariables, URLLoader, and URLRequest classes. It will be very useful for you to use or adapt it for your Flash projects.



36 responses so far ↓
1 AS2 Flash Contact Form // Aug 15, 2008 at 8:37 am
[…] Related Post: Flash Contact Form in ActionScript 3 […]
2 kick // Aug 22, 2008 at 10:29 am
how do i enter the email address to where i want the message to be sent?
3 admin // Aug 22, 2008 at 10:31 am
Hi kick, please follow http://www.webdesignmo.com/blog/2008/05/26/as2-flash-contact-form for it.
4 hyperbola // Aug 26, 2008 at 3:08 am
I believe I’ve set everything up correctly, however, I get an error message saying (I’ll translate from German to English (roughly)):
Error: Error #2101: The URLVariables.decode() passed String must have a URL-coded String with Name/Value-pair.
at Error$/throwError()
at flash.net::URLVariables/decode()
at flash.net::URLVariables()
at test4_fla::MainTimeline/submit()
What have I missed out?
Thanks,
-Hyper
5 CobaltBlueDW // Sep 17, 2008 at 3:05 am
^hyperbola.
This problem is usually caused by extra &. In AS3 there can’t be any & at the beginning or end of the string, and there can only be one in between each name/value pair.
Try stripping out the extra & with this:
static public function strip(urlEncoding:String):String{
var x=-1;
while((x = urlEncoding.indexOf(”&”, x+1))!= -1){
var y=x;
while(urlEncoding.charAt(++y)==”&”);
urlEncoding = urlEncoding.substring(0,x+1)+urlEncoding.substring(y);
}
if(urlEncoding.charAt(0)==”&”)urlEncoding = urlEncoding.substring(1);
if(urlEncoding.charAt(urlEncoding.length-1)==”&”)urlEncoding = urlEncoding.substring(0,urlEncoding.length-1);
return urlEncoding;
}
6 CobaltBlueDW // Sep 18, 2008 at 4:01 am
I actually went a step further and made a replacement class for URLVariables. I posted it @ http://www.actionscript.org/forums/showthread.php3?p=791377#post791377
Enjoy!
7 Arjhun Srinivas // Sep 22, 2008 at 6:43 pm
Dear webdesignmo team ,
You have very wonderful reply forms .. keep it up
Good Luck ,
Arjhun
8 sv creation // Sep 30, 2008 at 4:38 pm
Thanks That is very useful to me i am really very-2 Thankful to you
Sunil Sharma
9 sv creation // Sep 30, 2008 at 4:41 pm
I am urgetely need flash contact form so it will very usefull to me
Thanks Webdesignmo
Sunil sharma
10 Tom Wheeler // Oct 6, 2008 at 4:35 am
Hi
Im new to actionscript so i may be doing something wrong but i have changed the reciever email to my email, uploaded the site to my server, when i test the contact form it says sending at the bottom but the doesnt do anything and i dont recieve an email?
Any help will be greatly appreciated
Regards
Tom
11 armin // Oct 18, 2008 at 6:21 pm
Hi guys, the form is great you did and it helps me a lot.
There is just one problem. It works great if I put the swf file like a separate page inside an index file, but if I put it inside another swf movie on the server you cannot put the words inside the box fields, on the other side, you can put them regulary on my desktop.
What can be the problem ?
12 Mr-Yellow // Oct 30, 2008 at 10:41 am
Putting the source as an image sucks.
I only need 2 lines and I have to type them out instead of copy & paste.
It’s not user friendly however “cool” it might look.
-Ben
13 admin // Oct 30, 2008 at 11:23 am
Mr-Yellow,
You may download the source file for copy and paste.
Thanks.
14 Jack // Oct 31, 2008 at 6:04 am
very nice… i’m going to try on my website. Thanks you
15 Disco Stu // Nov 1, 2008 at 11:28 pm
The download link goes to a template site.
16 shiraz // Nov 19, 2008 at 8:04 pm
i want to use this contact form but edit it because i want to make a reservation page for my website will it be easy to edit the code on this and if i edit the code will i need to edit the php file to
17 jaziel // Nov 26, 2008 at 1:40 pm
thank you for sharing the tutorial. I learned a lot through this. keep it up!
18 Daniel // Nov 27, 2008 at 12:11 am
I actually want to create a whole new form for ppl to enrol in courses. Whats the easiest way to do it?
A simple form that is easy to understand and complete and send. I have the fom made already in html for my current site. basically want to copy paste it into the flash site.
Thanks.
Daniel
19 RJozsa // Dec 11, 2008 at 7:01 am
Just wanted to extend my thanks for your work online. I happen across your blog from time to time and fine it very helpful.
Regarding the use of images, rather than code for examples. Keep it up. Works great for me.
20 Beata // Dec 13, 2008 at 7:26 pm
I will try it.
21 erik // Dec 20, 2008 at 1:01 am
I can’t seem to find the download, link brings me to your site, but not anywhere that the files can be downloaded, any help please. thanks
22 guja // Dec 29, 2008 at 7:16 pm
I need some help… I think everything is on right place but when I click on send button message_status shows “Failed! Your message cannot sent” and I receive the message to my mail…
Any help would be most appreciated….
23 poopydoo // Jan 2, 2009 at 7:57 am
I am a total n00b at php who’s having the same problem as guja, except it doesn’t send the email to me. My server is set up to handle php, and I just don’t know what I’m doing wrong. Any pointers?
24 cory // Feb 14, 2009 at 10:38 am
it works great with the basic for but when i change it to the auto responder it just says sending and never processes?
How can I get the auto responder to work?
thanks.
25 Vilimas // Mar 2, 2009 at 3:29 am
Hi,
who can tell me, how to fix the problem in the input text?
There doesn’t work other input languages after embed fonts.
I mean, I have: “input text” in the “contact message”, embed: Basic Latin, Latin Extended I, Latin Extended A and Extended B.
But, when I open the website, switch keybord language to Lithuanian and write, I get letters:
aceei uu+ (EN keyboard buttons 12345678=) instead of:
ąčęėįšųūž.
If I paste the right letters it works, but the visitors will not find the double way.
26 Sondre // Mar 11, 2009 at 12:59 pm
Hello, seems like I have a little problem, probably just to tired to figure it out, but still getting “failed to send” message…
Somewhere I need to change something, but can’t seem to find it. Could you pls just tell me…
27 JP // Mar 13, 2009 at 1:27 pm
Hi,
everything seems fine, except i’m not receiving any email or confirmation??? is there something i should look for in the .php or .fla
28 taralynmary // Mar 14, 2009 at 11:57 am
I’m having the same problem as JP…my form will show that it sends, but I’m not receiving anything on the e.mail side. Very frustrating!!
Any suggestions would save me some sanity!!!
29 Kyran // Mar 18, 2009 at 7:48 am
Hey,
I have put the code and everything into my site and it says that there are errors with all the code. It says it all can not be ‘loaded’?
30 jessica // Apr 1, 2009 at 7:33 am
Hi , Please I need some help!! I’m new to AS3, and I don’t know where I have to put this code:
“Try stripping out the extra & with this:
static public function strip(urlEncoding:String):String{
var x=-1;
while((x = urlEncoding.indexOf(”&”, x+1))!= -1){
var y=x;
while(urlEncoding.charAt(++y)==”&”);
urlEncoding = urlEncoding.substring(0,x+1)+urlEncoding.substring(y);
}
if(urlEncoding.charAt(0)==”&”)urlEncoding = urlEncoding.substring(1);
if(urlEncoding.charAt(urlEncoding.length-1)==”&”)urlEncoding = urlEncoding.substring(0,urlEncoding.length-1);
return urlEncoding;
}”
Thanks for your answer!
31 Oscar // May 8, 2009 at 2:18 am
hello, i use the code that you guys used on the contact form, but i have a problem with it and i was hopeing that you can help, the problem is that wen i type in a correst e-mail on the e-mail inputbox the AS is not making the proper validation and it keeps sending me the message that i need to type in a valid e-mail, can any body help me im adding my code so you can see if i have any thing wrong with it taks.
nombre_contacto.text = email_contacto.text = asunto_contacto.text =
mensaje_contacto.text = mensaje_status.text = “”;
boton_enviar.addEventListener(MouseEvent.CLICK,enviar); // para boton de envia e-mail
boton_limpiar.addEventListener(MouseEvent.CLICK,limpiarforma); //para boton de limpiar forma
var timer:Timer;
var var_load:URLLoader=new URLLoader;
var URL_request:URLRequest=new URLRequest(”Cont_telecom.php”);
URL_request.method=URLRequestMethod.POST;
function enviar(e:MouseEvent):void
{
if(nombre_contacto.text==”" ||email_contacto.text==”" ||
asunto_contacto.text==”"||mensaje_contacto.text==”")
{
mensaje_status.text=”Por favor llene todos los campos.”;
}
else if(!validacion_email(email_contacto.text))
{
mensaje_status.text=”Por favor introdusca una dirección de correo valida.”;
}
else
{
mensaje_status.text=”Enviando su mensaje……….”;
var datos_email:String= “nombre=”+ nombre_contacto.text
+ “&email=”+ email_contacto.text + “&asunto=”+ asunto_contacto.text
+ “&mensaje=”+ mensaje_contacto.text;
var URL_vars:URLVariables=new URLVariables (datos_email);
URL_vars.dataFormat = URLLoaderDataFormat.TEXT;
URL_request.data=URL_vars;
var_load.load(URL_request);
var_load.addEventListener(Event.COMPLETE, recibir_respuesta);
}
}
function limpiarforma(e:MouseEvent):void
{
nombre_contacto.text = email_contacto.text = asunto_contacto.text =
mensaje_contacto.text = mensaje_status.text=”";
}
function validacion_email(s:String):Boolean
{
var p:RegExp=/(\W|[_.\-])+@((\W|-)+\.)+\W{2,4}+/;
var r:Object=p.exec(s);
if (r==null)
{
return false;
}
return true;
}
function recibir_respuesta(e:Event):void
{
var loader:URLLoader=URLLoader(e.target);
var email_status=new URLVariables(loader.data).succes;
if (email_status == “yes”)
{
mensaje_status.text= “Su mensaje a sido enviado”;
timer=new Timer(500);
timer.addEventListener(TimerEvent.TIMER, on_timer);
timer.start();
}
else
{
mensaje_status.text= “Su mensaje no pudo ser enviado”;
}
}
function on_timer(te:TimerEvent):void
{
if (timer.currentCount>=10)
{
nombre_contacto.text=email_contacto.text=asunto_contacto.text=
mensaje_contacto.text=mensaje_status.text=”";
timer.removeEventListener(TimerEvent.TIMER,on_timer);
}
}
32 Raven // Jun 2, 2009 at 5:29 am
This form works great for me, but I have one question about the focus of the text fields changing when I hit “tab” on the key board to get to the next text field.
I will start writing in the “name” text field, but when I hit tab on my keyboard to move to the next text field, it jumps the focus to a navigation button, rather than to the next text field. If I hit tab again, it doesn’t go anywhere - it’s like the focus jumps out of the form completely. Any advice on keeping the focus inside the form, so that users can tab through the text fields? Thanks!
33 Liam // Jun 20, 2009 at 2:38 am
Hi,
I’m thinking of using the flashmo_081 and I need your help in how do i change the contact us form so as it sends it’s emails to the address i specify.
I thought it was PHP but there is no .php file included in the zip file
Your help is greatly appreciated
34 Maiano // Jun 24, 2009 at 12:20 am
Hi, Im very new doing flash websites, I used you template to create a website, and everything looks great, I added the contact form, did everything good, added the php file and didnt work. Called my hosting service and it doesnt support php but it does support asp. My question is, without messing up everything i have how can i create the asp file to be able to send the email. I used the template you have for contact form. Thanks
35 admin // Jun 24, 2009 at 9:27 am
Hi Maiano,
You just need to search for sample ASP mail function and make send_email.asp file with the same concept applied in PHP.
36 chris // Jun 27, 2009 at 8:33 am
Hi, was just wondering if there is a way of setting the keyboard language. Im in EnUK so my @ key is where US ” is. When typing in my form, it reverses them. Any ideas?
Leave a Comment