In the below example we will use Actionscript 2 to call a remote PHP file that will return data to it.
It is a simple way of transferring data between the server and client.

Actionscript 2 Code:

[code lang=”actionscript”]
callRemoteFile = function(ourVariable:String) {
var result_lv:LoadVars = new LoadVars();
result_lv.onLoad = function(success:Boolean) {
if (success) {
if (result_lv.message==”success”)
trace(“done! “+result_lv.returnValue);
else
trace(result_lv.message);
} else {
trace(“Error connecting to server”);
return false;
}
};
var send_lv:LoadVars = new LoadVars();
send_lv.ourVariable = ourVariable;
send_lv.sendAndLoad(“http://www.andrewodendaal.com/example/file.php”, result_lv, “POST”);
}
callRemoteFile(“some text here”);
[/code]

PHP Code:

[code lang=”php”]
a=1&message=success&returnValue=&b=2[/code]