This content has been marked as final. Show 5 replies
Typo. Should be:
Your onLoad doesn't fire because the call to the php-file never gets made. The script works fine if you use a 'normal' url and not an IP-address:
lVars.sendAndLoad(" http://www.yoursite.com/Flawless/medallionAlerts.php", lVars, "POST");
Thank you for helping me with this.
I fixed the typo change the variable from lVars to lVars_lv and created the object separately from definition as follows:
---- Oringinal code -----
var lVars:LoadVars = new LoadVars();
---- New code ----
lVars_lv = new LoadVars();
changed the sendAndLoad invocation to use a domain name instead of an ip as follows:
---- origiinal code -------
lVars.sendAndLoad(" http://22.214.171.124/Flawless/medallionAlerts.php", lVars, "POST");
trace("PHP Sent. Message: " + lVars.message);
----- new code --------
I also initialized the message property before invoking the php script as below:
lVars_lv.message = "OldValue";
trace("Old message: " + lVars_lv.message); // displays OldValue
lVars_lv.sendAndLoad(" http://testingsite.com/Flawless/medallionAlerts.php", lVars_lv, "POST");
trace("message: " + lVars_lv.message); // displays nothing
Now the onload event is fired, but nothing is returned in the message property.
What do you think?
Is the url correct? Or is it a fake url?
I'm using the code attached (and it works fine). FTP the PHP-code to a domain and first establish the connection.
I found the problem. The php script and the onLoad were working fine.
The problem was that I was trying to return a link to another url and it had few parameters, so Flash got confused with the "&" contained in the link.
I changed the php script to return strings with no "&" then put the link together inside Flash.
Something that was really helpful to discover the problem was to do a trace of the LoadVars object. It displayed all properties and values. So, I found out it where the problem was.
By the way, I tested using an IP and a domain name once I found it was working. It make no difference. I am using Linux RH 8 and IE 6.
I really appreciate your help.
You're welcome. It's always hard trying to find the error with server side scripting. That's why I was asking for your php script. But, good you solved it! Good luck.