Hi all you clever people and hope you can help.
I’m trying to convert some AS1 code into AS3, it is a contact form and, mostly I’ve got it sorted but struggling with a couple of lines and am wondering if any of you can help. Oh, by the way, the code works fine as AS1.
Here’s my part converted code with my problem areas highlighted in red…
stop();
send_btn.addEventListener(MouseEvent.CLICK, sendMessage);
function sendMessage(e:MouseEvent):void{
var my_vars:URLVariables = new URLVariables();
my_vars.name = name_box.text;
my_vars.sender = email_box.text;
my_vars.tel = tel_box.text;
my_vars.subject = subject_box.text;
my_vars.message = message_box.text;
if (my_vars.sender != “” && my_vars.subject != “” && my_vars.message != “” && my_vars.name !="") {
my_vars.sendAndLoad(“mailer.php”, my_vars, “POST”);
gotoAndStop(2); // gives user feedback on send progress.
} else {
error_clip.gotoAndPlay(2);
}
[COLOR=red]my_vars.onLoad = function()[/COLOR] {
gotoAndStop(3); // tells them the email has been sent.
}
}
[COLOR=red]email_box.onSetFocus = subject_box.onSetFocus=message_box.onSetFocus=function ()[/COLOR] {
if (error_clip.currentframe != 1) {
error_clip.gotoAndPlay(19); // tells them to try filling in the fields again.
}
}
So of the 2 highlighted areas, the 1st one I don’t really understand the function () statement but AS3 doesn’t generate errors for this. The second chunk of code does generate errors.
Any help would be appreciated, thanks for reading this.
Rog