MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE Manuale Utente Pagina 132

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 155
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 131
ADOBE FLASH MEDIA INTERACTIVE SERVER
Server-Side ActionScript Language Reference
129
Example
The following example uses the
XML.lastChild property to iterate through the child nodes of an XMLNode object,
starting with the last item in the nodes child list and ending with the first child of the nodes child list:
// Create a new XML document.
var doc = new XML();
// Create a root node.
var rootNode = doc.createElement("rootNode");
// Create three child nodes.
var oldest = doc.createElement("oldest");
var middle = doc.createElement("middle");
var youngest = doc.createElement("youngest");
// Add the rootNode as the root of the XML document tree.
doc.appendChild(rootNode);
// Add each of the child nodes as children of rootNode.
rootNode.appendChild(oldest);
rootNode.appendChild(middle);
rootNode.appendChild(youngest);
// Use lastChild to iterate through the child nodes of rootNode.
for (var aNode = rootNode.lastChild; aNode != null; aNode = aNode.previousSibling) {
trace(aNode);
}
/*
output:
<youngest />
<middle />
<oldest />
*/
The following example creates a new XML packet and uses the XML.lastChild property to iterate through the child
nodes of the root node:
// Create a new XML document.
var doc = new XML("<rootNode><oldest /><middle /><youngest /></rootNode>");
var rootNode = doc.firstChild;
// Use lastChild to iterate through the child nodes of rootNode.
for (var aNode = rootNode.lastChild; aNode != null; aNode=aNode.previousSibling) {
trace(aNode);
}
/*
output:
<youngest />
<middle />
<oldest />
*/
XML.load()
my_xml.load(url)
Vedere la pagina 131
1 2 ... 127 128 129 130 131 132 133 134 135 136 137 ... 154 155

Commenti su questo manuale

Nessun commento