Complete Flash / AS Noob here. Friend wanted a change in Email address and I'm assisting. I notice at the bottom it posts to a formmail.php
file but I was wondering if there was an easier way or perhaps someone could help me understand what exactly it POSTS and how AS handles POST methods so I can rewrite a script. As formmail.php
is some script from "Andrew Riley ([email protected])"
function playTier() {
switch(this.tierContent.tier_txt.text) {
case "Sinking Ship":
bullseye_mc.arrow_ani._x = 205; break;
case "Piggy Bank":
bullseye_mc.arrow_ani._x = 180; break;
case "Loose Change":
bullseye_mc.arrow_ani._x = 155; break;
default:
trace("error for arrow posX")
}
bullseye_mc.arrow_ani.play();
sendEmail();
}
tierContent._alpha = 100;
var recipient = "[email protected]";
var subject = "AP Form";
var nameField:String;
var emailField:String;
var phoneField:String;
var commentsField:String;
//alert format
var alertFormat = new TextFormat();
alertFormat.color = 0xFF0000;
var fields:Array = new Array("name_txt", "email_txt", "phone_txt", "comments_txt");
function alertField():Boolean {
var checkFailure:Number = 0;
for (i=0; i<fields.length; i++) {
if (this[fields[i]].length<1) {
checkFailure++;
trace(checkFailure+"-checkFailure");
this[fields[i]].text = "Required!";
this[fields[i]].setTextFormat(alertFormat);
}
}
if (checkFailure>0) {
return false;
} else {
return true;
}
}
function successWindow() {
this.createTextField("my_txt",1,90,212,300,0);
this.my_txt.background = true;
this.my_txt.backgroundColor = 0x00CC00;
my_txt.multiline = true;
my_txt.autoSize = true;
my_txt.wordWrap = true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0xFFFFFF;
my_fmt.size = 11;
my_fmt.font = "Verdana";
my_txt.text = "Thank You. Your information has been submitted.";
my_txt.setTextFormat(my_fmt);
}
function progressWindow() {
this.createTextField("progress_txt",1,90,212,300,0);
this.progress_txt.background = true;
this.progress_txt.backgroundColor = 0xFD530B;
progress_txt.multiline = true;
progress_txt.autoSize = true;
progress_txt.wordWrap = true;
var progress_fmt:TextFormat = new TextFormat();
progress_fmt.color = 0xFFFFFF;
progress_fmt.size = 11;
progress_fmt.font = "Verdana";
progress_txt.text = "Transmitting your information.";
progress_txt.setTextFormat(progress_fmt);
}
function sendEmail() {
switch (alertField()) {
case true :
progressWindow()
trace("break!");
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
trace("Form sent!");
successWindow();
} else {
trace("Error in sending");
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.recipient = "[email protected]";
send_lv.subject = "AP Form";
send_lv.sort = "order:name,company,email,phone,question1,question2,question3,question4,question5,question6,question7,question8"
send_lv.name = this._parent.q9.name_txt.text;
send_lv.company = this._parent.q9.company_txt.text;
send_lv.email = this._parent.q9.email_txt.text;
send_lv.phone = this._parent.q9.phone_txt.text;
send_lv.question1 = this._parent._parent.qArray[0];
send_lv.question2 = this._parent._parent.qArray[1];
send_lv.question3 = this._parent._parent.qArray[2];
send_lv.question4 = this._parent._parent.qArray[3];
send_lv.question5 = this._parent._parent.qArray[4];
send_lv.question6 = this._parent._parent.qArray[5];
send_lv.question7 = this._parent._parent.qArray[6];
send_lv.question8 = this._parent._parent.qArray[7];
send_lv.sendAndLoad("formmail.php",result_lv,"POST");
if(lvBytesLoaded < lvBytesTotal) {
progressWindow()
}
break;
case false :
trace("Error missing fields- nothing sent");
break;
default :
trace("Something bad happen");
break;
}
};