AS3 Manipulating XML files

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.