Hi all,
I’ve been searching far and wide for solid documentation on loading variables from a php file into as3. Although I’ve found a few bits and bobs I’ve not manage to come up with anything that works yet.
PHP
<?php
$galleryIdent=$_POST['galleryOne'];
echo "galleryIdent=".$galleryIdent;
?>
AS3
private var phpVariables:URLVariables;
private var phpRequest:URLRequest;
private var phpLoader:URLLoader;
private function loadPHP():void
{
phpVariables = new URLVariables();
phpRequest = new URLRequest("galleryPHP/galleryPHP.php");
phpRequest.data = phpVariables;
phpRequest.method = URLRequestMethod.POST;
phpLoader = new URLLoader();
phpLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
phpLoader.load(phpRequest);
phpLoader.addEventListener(Event.COMPLETE, phpLoadingComplete);
phpLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorListener);
}
private function phpLoadingComplete(e:Event):void
{
trace(e.target.data.galleryIdent);
}
Now the trace gives me:
%3C%3Fphp%0D%0A%24galleryIdent=%24%5FPOST%5B%27galleryOne%27%5D%3B%0D%0A%0D%0Aecho%20%22galleryIdent%3D%22%2E%24galleryIdent%3B%20%20%0D%0A%3F%3E
So it’s clearly communicating I’ve just go no idea how to turn that into the galleryIdent string I need.
Any suggestions?
Thanks in advance
Sigs