as与asp.net通信

// 以XML形式与ASP.NET通信


function showXml():void
 {
var v:URLVariables = new URLVariables()
var r:URLRequest = new URLRequest();
r.url = "http://localhost/handle.aspx";
r.method = URLRequestMethod.GET;
r.data = v;


var l:URLLoader = new URLLoader();
l.load(r);
l.addEventListener(Event.COMPLETE, Complete);
}

function Complete(event:Event):void
 {
var l:URLLoader = event.target as URLLoader;
var xml:XML = new XML(l.data);
//循环输出xml内容
  }

 

 

// 以JSON形式与ASP.NET通信

function showJSON():void
 {
var v:URLVariables = new URLVariables()
var r:URLRequest = new URLRequest();
r.url = "http://localhost/handle.aspx";
r.method = URLRequestMethod.GET;
r.data = v;


var l:URLLoader = new URLLoader();
l.load(r);
l.addEventListener(Event.COMPLETE, Complete);
}

function Complete(event:Event):void
 {
var l:URLLoader = event.target as URLLoader;

var v:* = JSON.decode(l.data);


}

posted @ 2011-11-22 11:24  高捍得  阅读(210)  评论(0编辑  收藏  举报