MACROMEDIA FLASH MEDIA SERVER 2-SERVER-SIDE ACTIONSCRIPT LANGUAGE Reference page 172

Server-side actionscript language reference
Table of Contents

Advertisement

Description
Method; appends the specified node to the XML object's child list. This method operates
directly on the node referenced by the
node. If the node to be appended already exists in another tree structure, appending the node
to the new location will remove it from its current location. If the
to a node that already exists in another XML tree structure, the appended child node is placed
in the new tree structure after it is removed from its existing parent node.
Example
The following example performs the actions in this list:
1.
Creates two empty XML documents,
2.
Creates a new node, using the
method, to the XML document named
appendChild()
3.
Shows how to move a node using the
from
to
doc1
doc2
4.
Clones the root node from
5.
Creates a new node and appends it to the root node of the XML document
var doc1 = new XML();
var doc2 = new XML();
// Create a root node and add it to doc1.
var rootnode = 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 = 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 = doc1.createElement("newbie");
clone.appendChild(newNode);
trace ("doc1: " + doc1); // output: doc1: <root><newbie /></root>
In Flash Media Server, the output of
file and Application inspector.
172
Server-Side ActionScript Language Reference
childNode
doc1
createElement()
appendChild()
.
and appends it to
doc2
trace()
parameter; it does not append a copy of the
childNode
and
.
doc2
method, and appends it, using the
.
doc1
method, by moving the root node
.
doc1
statements appears in the application log
parameter refers
.
doc1

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MEDIA SERVER 2-SERVER-SIDE ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash media server 2

Table of Contents