[Tutorial] How to pass variables between FLASH and PHP
The first time I faced this need, I was totally clueless. Back then, I know FLASH and I know PHP but passing variables between the two is something that's I'm totally new with. This brought me to search tutorials on the web and came across the command that does it.
loadVariablesNum() and it's variant, loadVariables()
You call loadVariablesNum() when you are loading variables to the _root level and call loadVariables() when you are loading variables to a sprite.
Here are some examples:
- onFrame (1) {
loadVariablesNum("myphpscript.php",0);
} - onFrame (1) {
spriteName.loadVariables("myphpscript.php");
}
- echo "&var1=value1&var2=value2&var3=value3";
- &var1=value1&var2=value2&var3=value3
We use the same set of command but this time, we specify another parameter - a choice of GET or POST
- onFrame (1) {
loadVariablesNum("myphpscript.php",0,'POST');
} - onFrame (1) {
spriteName.loadVariables("myphpscript.php", 'POST');
}
- var sUserName = "pinoywebdev";
- $sUser = $_POST['sUserName'];
If you try the above and found errors, please let me know.







