开发者

How to take input from an xml file during a Flash Program

Hi I was wondering I could make my flash program take input from an xml file to cre开发者_运维知识库ate various shapes dynamically?


You need to use the URLLoader class to get the xml data in your application.


var loader:URLLoader = new URLLoader();
var req:URLRequest = new URLRequest();

var xmlURL:String = "http://example.com/data.xml"

loader.addEventListener(Event.COMPLETE , completeHandler );
loader.load(req);


function completeHandler(event:Event):void
{
    trace( event.target.data );// traces your xml content     
    // retrieve your data then use it 
    //for your display methods
    parseXML(event.target.data ); 

}



0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜