jiles at jasnetworks dot net
The new version for ActionScript 3 does not come with any examples and the two lines of code on the site doesn't do anything as well. I was able to get it working correctly, but it might save someone else a couple hours of head ache if you just provide an example. To save you the time here is my simple example that works.
PHP File(test.php)
<?php
$tiger = array();
$tigger['test'] = 100;
$tigger['bugger'] = 'this sucks';
echo "result=". serialize($tigger);
?>
Flash File
actionscript in frame 1
import flash.net.*;
import org.sepy.io.Serializer;
var request:URLRequest = new URLRequest("http://localhost/test.php");
var loader:URLLoader = new URLLoader();
loader.addEventListener(Event.COMPLETE, onComplete);
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.load(request);
function onComplete(event:Event):void {
var recieved:String = URLLoader(event.target).data.result;
var dataRecieved:* = Serializer.unserialize(recieved);
trace(recieved);//data recieved before unserialize
trace(dataRecieved.test);
trace(dataRecieved.bugger);
}
stop();