Hey,
I have a XML problem which I just can't figure out. After failing several times I found a tut on Kirupa and it seems to me I'm doing it the same way. The only difference is mine doesn't work.
I won't paste all my code but just the XML. If the rest is needed just let me know and I can post it:
AS
var container_xml:XML = new XML();
container_xml.onLoad = startXML;
container_xml.load("container_xml.xml");
container_xml.ignoreWhite = true;
function startXML(success){
if (success == true){
rootNode = container_xml.firstChild
}
}
........
xmlLength = rootNode.childNodes;
for(i=0;i<xmlLength.length; i++){
currentNode = xmlLength[i];
xmlLength = rootNode.currentNode.childNodes;
for(ii=0;ii<xmlLength.length; ii++){
firstKid = xmlLength.firstChild;
heightOffSet = parseInt(firstKid.firstChild);
centerOffSet = parseInt(firstKid.nextSibling.firstChild);
}
}
- var container_xml:XML = new XML();
- container_xml.onLoad = startXML;
- container_xml.load("container_xml.xml");
- container_xml.ignoreWhite = true;
- function startXML(success){
- if (success == true){
- rootNode = container_xml.firstChild
- }
- }
- ........
- xmlLength = rootNode.childNodes;
- for(i=0;i<xmlLength.length; i++){
- currentNode = xmlLength[i];
-
- xmlLength = rootNode.currentNode.childNodes;
- for(ii=0;ii<xmlLength.length; ii++){
- firstKid = xmlLength.firstChild;
- heightOffSet = parseInt(firstKid.firstChild);
- centerOffSet = parseInt(firstKid.nextSibling.firstChild);
- }
- }
XML
<root>
<container a="container">
<h>10</h>
<o>0</o>
</container>
</root>
- <root>
- <container a="container">
- <h>10</h>
- <o>0</o>
- </container>
- </root>
I think the problem is that currentNode = xmlLength[i]; is equal to more than just that child name, but to everything within the container child.
Any one see what I'm doing wrong?