Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Actionscript PHP callback not working

Status
Not open for further replies.

Nutthick

MIS
Jan 14, 2004
126
GB
I'm doing an email interface in FlashMX2004, calling PHP to send the email. My PHP works fine, I can call it from the web, but the feedback from the script isn't being picked up by the Action Script. The PHP returns a value in the following format.

echo 'response=passed';
echo 'response=error';

I'm calling the PHP from the AS with

dataSender.sendAndLoad(" dataReceiver, "POST");

a callback function is define before the sendAndLoad as follows

dataReceiver.onLoad = function()
{
if (this.response == "invalid")
{
_root.gotoAndStop(1);
alert_txt.text = "Please check email address - does not appear valid."
}
else if (this.response == "error")
{
_root.gotoAndStop(3);
}
else if (this.response == "passed")
{
_root.gotoAndStop(4);
}
}

My problem is that the 'this.response' is always coming up as undefined in AS. It looks like the values aren't making it back from the PHP.

I define the two vars at the top of the script

dataSender = new LoadVars();
dataReceiver = new LoadVars();

Does anyone have any idea what I'm doing wrong? Thanks
 
What do you get in the output panel if you put
Code:
trace(unescape(this));
in as the first line of your onLoad function?
 
Hi wangbar - I worked out it's a PHP error. Thanks anyway
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top