I have made a simple form with Flash 8, and on the first frame on the main
timeline, i have addes he following AC code:
fieldsFilled = new Object();
fieldsFilled.onKeyUp = function() {
if(destMail_txt.text != ' ' && senderName_txt.text != ' ' && senderBody != ' '
) {
send_btn.enabled = true;
}
else {
send_btn.enabled = false;
}
}
Key.addListener(fieldsFilled);
send_btn.enabled = false;
var sendMail_lv:LoadVars = new LoadVars();
send_btn.onRelease = function() {
sendMail_lv.destMail = destMail_txt.text;
sendMail_lv.senderName = senderName_txt.text;
sendMail_lv.senderBody = senderBody_txt.text;
sendMAil_lv.sendAndLoad(http://PATHtoMYserver/sendMail.php", sendMail_lv,
"POST");
}
Then i have a PHP file on my server that i tested and works perfectly. The
problem is thta Flash doesn't want to communicate with PHP: what can i do? Is
there a problem in the script? I've tried several times during the last two
days, but not success.
Thanks,
Vinnie
Krishana_79 - 21 Aug 2007 12:04 GMT
Hi all_begin,
here you have to create an another loadvar (which will be the return the data
in order to you request ) object like to have made "var sendMail_lv:LoadVars =
new LoadVars();". The newer may be "var resultMail_lv:LoadVars = new
LoadVars();" and then you have to put this "resultMail_lv" in "sendAndLoad"
method of flash like :
sendMAil_lv.sendAndLoad(http://PATHtoMYserver/sendMail.php", resultMail_lv
"POST");.
Now, you have to write bit of code in your send_btn.onRelease function to
load data that you want to get from your php file.
//----------------
resultMail_lv.onLoad = function(success:Boolean) {
if (success) {
result_ta.text = resultMail_lv.welcomeMessage;
} else {
result_ta.text = "Error connecting to server.";
}
};
//------------------
here " result_ta " will be the text area in which you can show the data which
is cominig from your php side.