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


}

你可能感兴趣的:(asp.net)