AS3与PHP通信的五种方法(基于HTTP协议)(4)
sendData.writeBytes(byteArr);
phpUrl.data = sendData;
urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
urlLoader.load(phpUrl);
urlLoader.addEventListener(Event.COMPLETE, completeHandler5);
//-----------------------------------------------------------------------------
}
private function completeHandler1(e:Event):void
{
var vars:URLVariables = URLVariables((e.currentTarget as URLLoader).data);
trace("接受数据:" + vars.value); //假定value是PHP里面自定义的节点值
}
private function completeHandler2(e:Event):void {
var xml:XML = new XML((e.currentTarget as URLLoader).data);
trace("xml数据:" + xml.toString());
}
private function completeHandler3(e:Event):void {
trace("GET-已经传出去的数据:" + (e.currentTarget as URLLoader).data);
}
private function completeHandler4(e:Event):void {
trace("POST-已经传出去的数据:" + (e.currentTarget as URLLoader).data);
}
private function completeHandler5(e:Event):void {
var _byteArr:ByteArray = e.currentTarget.data as ByteArray;
相关新闻>>
- 发表评论
-
- 最新评论 更多>>