import flash.net.URLLoader; import flash.net.URLRequest; import flash.events.MouseEvent; import flash.events.Event; var misVariables: URLVariables = new URLVariables(); var cargador: URLLoader = new URLLoader(); var pedido: URLRequest = new URLRequest (); pedido.url= "http://wwww.ddrmexicana.com/enviarMail.php"; pedido.method= URLRequestMethod.POST; pedido.data= misVariables; cargador.dataFormat= URLLoaderDataFormat.VARIABLES; enviar_btn: addEventListener(MouseEvent.CLICK, enviar); cargador: addEventListener(Event.COMPLETE, cargaCompleta); function enviar(event:MouseEvent) { if(mail_txt.text.indexOf("@") == -1 || mail_txt.text.indexOf(".") == -1) { status_txt.text = "introduce un mail correcto"; } else { enviarformulario(); } } function enviarformulario() { misVariables.nombre = nombre_txt.text; misVariables.telefono = telefono_txt.text; misVariables.mail = mail_txt.text; misVariables.mensaje = mensaje_txt.text; try { cargador.load(pedido) } catch (error:Error) { trace ("Error en el envio"+error); } } function cargaCompleta(event:Event):void { nombre_txt.text = ""; telefono_txt.text = ""; mail_txt.text = ""; mensaje_txt.text = ""; gotoAndStop(60); } stop();