Flash
// first we make a new loadvars object to hold the variables that are being loaded from the php file
myData = new LoadVars();
//this is the part where we execute the function that handles the loaded data
myData.onLoad = function(){
VariableLoad();//call the function
};
//here we load in the php file, make sure you set the right path to your file
myData.load(“http://localhost/index.php”);//this is the function that handles the data.
//the variables now sorta live in the loadVars object we set named myData
//So we can call em like myData.myVariableInthePhpPrintedString
//just look at the script and whatch carefully how its being called and it should become clear to ya.
VariableLoad = function(){
txtBox1.text = myData.textbData1;
txtBox2.text = myData.textbData2;
txtBox3.text = myData.textbData3;
};
PHP
<?php
/*Getting the variable ‘toPHP’ sent from flash using the ‘POST’ method*/
$fromFlash = $_POST['toPHP'];
/*Encrypting the $fromFlash and storing it as $encrypted*/
$encrypted = md5($fromFlash);
/*getting ready to send a variable to flash named toFlash using ‘&variableName=’*/
$toFlash = “&toFlash=”;
/*Asigning the encrypted variable to $toFlash AFTER the ‘=’*/
$toFlash .= $encrypted;
/*echoing out $toFlash so that flash can read it*/
echo $toFlash;
?>
