Simple LoadVars confusion

hi guys,

i was trying to learn how to do LoadVars with PHP. But i think i got lost in confusion with the path when to actually view the output, here’s the code:


var sendVar:LoadVars = new LoadVars();
var getVar:LoadVars = new LoadVars();
sendVar.flashVal = 5;
sendVar.sendAndLoad("http://localhost/loadvar/loadvar.php",getVar);
getVar.onLoad = function(){
trace(this.newVal);
}

and here’s the php code:


<?php
$phpVal = "$_POST['flashVal']";
$newVal = "$phpVal + 5";
echo $newVal;
?>

when i tried to see the result in flash through trace, i get an “undefined” value. I was ok with making .load for flash but i got lost with .sendAndLoad, esp on how to capture the variables sent from php to flash.

i would be thankful for anyone who has a good solution for this.

thanks for anyone’s help!

_ScriptRookie