[ActionScript 3.0] AS3 operations on XML, creating, deleting, and adding node methods

Source: Internet
Author: User

package{ImportFlash.display.Sprite; /** * @author: Frost.yen * @e-mail:[email protected] * @create: 2016-3-11 a.m. 11:31:11 **/     Public classOperatexmlextendsSprite {Private var_xml:xml = <data> <item>item1</Item> <item>item2</Item> <a>a</A> <b>b</B> </data>; Public functionOperatexml () {//Delete _xml.item[0];//Remove the first item node            //Delete _xml.a;//Remove a node                        varNewnode:xml = <c>c</c>;//_xml = _xml.insertchildafter (_xml.a,newnode);//Insert a new node after node a            //_xml = _xml.insertchildbefore (_xml.a,newnode);//Insert new node in front of Node a_xml = _xml.insertchildbefore (_xml.item[0],newnode);//inserting a new node in front of Node aTrace (_xml); //To reference a variable when constructing XML by using the curly brace operator {}            varArr:array = [1,2,3,4,5]; varAb:array = ["a","B"]; varXml:xml =NewXML ("<data></data>");  for(varI:int = 0;i<arr.length;i++){                varNode:xml =NewXML (); Node= <item id={arr[i]}> <a>{ab[0]}</A> <b>{ab[1]}</B> </item>;xml.appendchild (node);        } trace (XML); }    }}

[ActionScript 3.0] AS3 operations on XML, creating, deleting, and adding node methods

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.