Menu

#1 need a working example as 3

open
nobody
5
2008-02-03
2008-02-03
Anonymous
No

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();

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.