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 ); }
精彩评论