开发者

reading a url with flash

开发者 https://www.devze.com 2022-12-22 22:55 出处:网络
I have a flash applet that I want 开发者_开发问答to grab a remote XML file and read it in as a string, how can I do this?You can use a URLLoader to do this.

I have a flash applet that I want 开发者_开发问答to grab a remote XML file and read it in as a string, how can I do this?


You can use a URLLoader to do this.

var url:String = 'http://www.myurl.com/myxml.xml';
var req:URLRequest = new URLRequest( url );

var urlloader:URLLoader = new URLLoader();
urlloader.addEventListener( Event.COMPLETE, XMLLoaded );

urlloader.load( req );

function XMLLoaded( e:Event ):void {

    trace( urlloader.data ); //urlloader.data is a String
    var xml:XML = XML( urlloader.data ); //create an AS3 XML object from the xml string

}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号