Hello,
I have this contact email box, which works fine if its running as a movie on its own, but as soon as I load it into another movie and try to use it from there it just wont send through. Any ideas I really need help on this one!
the whole code is… (also fla attatched)
Cheers
/* For this tutorial this variable will hold which server-side file you wish to use.
For ASP, set serverLang = "asp", for PHP, set serverLang = "php"
And for Perl, set serverlang = "cgi"
This is for this tutorial. In your application this feature wont be required.
*/
var serverLang:String = "asp";
//Create a loadvars object named email_lv
var email_lv:LoadVars = new LoadVars();
//this function is called when email_lv loads the server-side script.
email_lv.onLoad = function(success) {
//If the script was successfully loaded, this condition is run
if (success) {
/* Though the server-side script was loaded, it does not mean it was
executed successfully. This condition gets a response from the
server-side script and determines if it was truly successful. */
if (email_lv.server_mes == "ok") {
status_txt.text = "Email Sent";
/* You can add additional code here. This is only run
if everything went as planned. */
}
} else {
//email failed to send, but script did load. Likely a server issue.
status_txt.text = "Email Failed";
}
};
/*This is the onRelease function for "submit_btn" button. This is only run
if the button was pressed. */
submit_btn.onRelease = function() {
/* Here we are validating the data. This insures the email address contains
both the "@" and ".", If not, it stops the script and alerts the user. */
if (!email_txt.length || email_txt.indexOf("@") == -1 || email_txt.indexOf(".") == -1) {
status_txt.text = "Invalid Email.";
//This validates the subject line contains text
} else if (!subject_txt.length) {
status_txt.text = "Missing Subject";
//This validates the message body contains text
} else if (!message_txt.length) {
status_txt.text = "Missing Message";
//If everything is filled out correctly, this is run.
} else {
//Collects the data from the text boxes and gives it to email_lv
email_lv.email_txt = email_txt.text;
email_lv.subject_txt = subject_txt.text;
email_lv.message_txt = message_txt.text;
/* Finally, send the data to the server and get a response.
As mentioned above, serverlang holds the file extendion for
the server side language. You can hard code the complete file name. */
email_lv.sendAndLoad("SendMail."+serverLang, email_lv, "POST");
}
};