PHPCommunication
package
{
import flash.display.Sprite;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
public class Main extends Sprite
{
private var _username:String = "josh";
private var _id:String = "143";
private var loader:URLLoader;
public function Main()
{
loader = new URLLoader();
loader.addEventListener(Event.COMPLETE, dataLoaded);
var request:URLRequest = new URLRequest("http://localhost:8888/PHPScript.php?username=" + _username + "&id=" + _id);
loader.load(request);
}
public function dataLoaded(event:Event):void
{
var xmlResponse:XML = XML((event.target as URLLoader).data);
trace(xmlResponse);
}
}
}
|