Long time no write AS3 program ... Mactan even a single XML read is not fast.
Here's a good example of what Flex Biulder has just written:
The code is as follows:
package{ImportFlash.display.Sprite; Importflash.events.Event; ImportFlash.net.URLLoader; Importflash.net.URLRequest; Public classTestxmlextendsSprite {Private varLod:urlloader; Private varurl:string="D:/testas3/testx.xml"; Private varurlre:urlrequest; Private varAllxml:xml; Public functionTestxml () { This. Init (); } Private functionInit ():void{urlre=Newurlrequest (URL); Lod=NewURLLoader (); Lod.load (URLRE); Lod.addeventlistener (Event.complete, This. Completehandler); } Private functionCompletehandler (event:event):void { varitemlist:xmllist; varListlength:int =0; varItem:xml; varIndex:int = 0; varstr:string; Allxml=NewXML (Lod.data); ItemList=Allxml.res; //Trace (itemList);Listlength =itemlist.length (); while(index<listlength) {Item=Itemlist[index]; STR=""; STR=[email protected]; Trace (str+"\ n"); Index++; } } }}
The following is the XML file to load:
<Li> <!--Game Resource Knowledge Series info - <!--If the parameters Isabsoluteurl: The absolute path is primarily convenient to set up different paths after updating the numbers - <ResID= "Loadertext"URL= "Xml/loadertext.xml"desc= "Show text"version= "201501280001" /> <ResID= "Localdata"URL= "xml/localdata/localdata.9d"desc= "Packet"version= "201501280001" /> <ResID= "Language"URL= "xml/language/language.9d"desc= "Language Pack"version= "201501280001" /> <ResID= "Codecode"URL= "error/codedata.9d"desc= "Error Language Pack"version= "201501280001" /> <ResID= "Gmdata"URL= "gm/gmdata.9d"desc= "Instruction Language Pack"version= "201501280001" /> <ResID= "Randomname"URL= "xml/randomname/randomname.9d"desc= "Random name language Pack"version= "201501280001" /> <ResID= "Conductscript"URL= "xml/conductscript/conductscript.9d"desc= "Battle Behavior Kit"version= "201501280001" /> </Li>
AS3 Manipulating XML files