toasty-o
08-24-2007, 01:25 AM
Hi,
I have some script for an email newsletter signup form in a flash site. The user inputs an email address into an input text field with variable name "emailAdd", hits a submit button, and flash runs a simple email validation check before sending the email to a php file. I've used this code successfully before, and it works perfectly in Flash 7, so I know there's no problem with the php file, but I can't get it to work in Flash 8 (with AS2). Please help!
Here's the actionscript:
submitButton.onPress = function() {
emailCheck();
};
function emailCheck() {
if ((this.emailAdd.length<5) || (this.emailAdd.indexOf("@")<=0) || (this.emailAdd.indexOf("@") !=this.emailAdd.lastIndexOf("@")) || (this.emailAdd.lastIndexOf(".")<this.emailAdd.indexOf("@")) || ((this.emailAdd.lastIndexOf(".")+3)>this.emailAdd.length)) {
emailBlock.text = "Enter a valid email address";
} else {
loadVariablesNum("process.php", 0, "POST");
getURL ("javascript:NewWindow=window.open('next_step','newW in','width=700,height=500,toolbar=No,location=No,s crollbars=No,status=No,resizable=No,fullscreen=No' ); NewWindow.focus(); void(0);");
emailBlock.text = "success";
}
}
I have some script for an email newsletter signup form in a flash site. The user inputs an email address into an input text field with variable name "emailAdd", hits a submit button, and flash runs a simple email validation check before sending the email to a php file. I've used this code successfully before, and it works perfectly in Flash 7, so I know there's no problem with the php file, but I can't get it to work in Flash 8 (with AS2). Please help!
Here's the actionscript:
submitButton.onPress = function() {
emailCheck();
};
function emailCheck() {
if ((this.emailAdd.length<5) || (this.emailAdd.indexOf("@")<=0) || (this.emailAdd.indexOf("@") !=this.emailAdd.lastIndexOf("@")) || (this.emailAdd.lastIndexOf(".")<this.emailAdd.indexOf("@")) || ((this.emailAdd.lastIndexOf(".")+3)>this.emailAdd.length)) {
emailBlock.text = "Enter a valid email address";
} else {
loadVariablesNum("process.php", 0, "POST");
getURL ("javascript:NewWindow=window.open('next_step','newW in','width=700,height=500,toolbar=No,location=No,s crollbars=No,status=No,resizable=No,fullscreen=No' ); NewWindow.focus(); void(0);");
emailBlock.text = "success";
}
}