PDA

View Full Version : PHP echo back to Flash Actionscript



TRPlace
November 8th, 2004, 05:39 PM
Hey everybody.
I am trying to do a simple php echo to flash. I want to do a loadvars.load("tomyscript.php",0,"POST"); and echo back an address....such as echo "&someFlashVar=http://someaddress.com/something"; in php and I want flash to be able to read it. I have sound very little on echo back to flash, maybe I am typing the wrong keywords.
I have done this before, but this was my code:

<?php
$returnvar=$testvar;
echo("returnvar=".$returnvar);
?>
I am not sure why that works and my other echo doesnt.
I tried using that script for my idea too and it didnt work. If someone can clear this up for me that would be great, so I can understand why it's not working and what it's doing. Thanks again!

tris
November 8th, 2004, 07:57 PM
You may have more luck posting the code that does NOT work then posting the code that does.

JUD
November 9th, 2004, 02:25 AM
Here, this should work:

var myVars:LoadVars = new LoadVars();
myVars.onLoad = function(success){
if(success){
var myAddress = this.returnVar;
}else{
return;
}
}
myVars.load("yourPhpFile.php");
//This will store the your returned address in a variable called myAddress


<?

$returnVar = $testVar;
echo "&returnVar=" .$retunrnVar;
//This is how to set up your php for flash to read

?>

Hope it helps

JUD