PDA

View Full Version : Actionscript to PHP using LoadVars()


sznsx
01-23-2005, 11:25 PM
I am atempting to send a variable from actionscript to PHP using the following actionscript code:

lvOut = new LoadVars();
lvOut.theData = myVariable;
lvOut.send("myScript.php","_blank");

I would like to know how to send the data and execute the PHP code without having to open it in "_blank". When I remove that parameter the variable is not sent and the PHP code is not executed.

I just want the variable to be sent and the PHP code to execute without opening any new windows or changing the current page. I know it's a simple fix I am just very blind.

SmoothDime
01-23-2005, 11:27 PM
try sendAndLoad() instead of just send()

sznsx
01-23-2005, 11:47 PM
Just tried it now and same thing happens when I remove the "_blank" in send(). Any other ideas?

Laguana
01-24-2005, 12:16 AM
I found that if i had the php echo something (not really useful, just something flash could pick up) and used send and load, it would work properly. You need 2 loadVars for sendAndLoad though, i'm pretty sure.

sznsx
01-24-2005, 01:04 AM
Thanks Laguana!

I was only supplying sendAndLoad with the first parameter which was the location of the php file. I set up a second LoadVar and used it as the second parameter resultset and it worked like a charm...


lvResult = new LoadVars();
lvOut = new LoadVars();
lvOut.theData = myVariable;
lvOut.sendAndLoad("myScript.php",lvResult);