MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference page 741

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

Parameters
- An XMLNode that represents the node to be moved from its current
newChild:XMLNode
location to the child list of the
Example
This example does the following things in the order shown:
Creates two empty XML documents,
Creates a new node using the
method, to the XML document named
appendChild()
Shows how to move a node using the
from
to
doc1
doc2
Clones the root node from
Creates a new node and appends it to the root node of the XML document
var doc1:XML = new XML();
var doc2:XML = new XML();
// create a root node and add it to doc1
var rootnode:XMLNode = doc1.createElement("root");
doc1.appendChild(rootnode);
trace ("doc1: " + doc1); // output: doc1: <root />
trace ("doc2: " + doc2); // output: doc2:
// move the root node to doc2
doc2.appendChild(rootnode);
trace ("doc1: " + doc1); // output: doc1:
trace ("doc2: " + doc2); // output: doc2: <root />
// clone the root node and append it to doc1
var clone:XMLNode = doc2.firstChild.cloneNode(true);
doc1.appendChild(clone);
trace ("doc1: " + doc1); // output: doc1: <root />
trace ("doc2: " + doc2); // output: doc2: <root />
// create a new node to append to root node (named clone) of doc1
var newNode:XMLNode = doc1.createElement("newbie");
clone.appendChild(newNode);
trace ("doc1: " + doc1); // output: doc1: <root><newbie /></root>
object.
my_xml
doc1
createElement()
appendChild()
.
and appends it to
doc2
and
.
doc2
method, and appends it, using the
.
doc1
method, by moving the root node
.
doc1
.
doc1
XMLNode
741

Advertisement

Table of Contents
loading

Table of Contents