MACROMEDIA FLASH MEDIA SERVER 2-SERVER MANAGEMENT ACTIONSCRIPT LANGUAGE Manuel d'utilisateur Page 132

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 155
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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)
Vue de la page 131
1 2 ... 127 128 129 130 131 132 133 134 135 136 137 ... 154 155

Commentaires sur ces manuels

Pas de commentaire