im trying to load images and a url from an xml, the images are working fine but the url im really struggling with
here is xml code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data[
<!ELEMENT title (comments, image)>
<!ATTLIST title name CDATA #REQUIRED>
<!ELEMENT comments (#PCDATA)>
<!ELEMENT image (#PCDATA)>
]>
<data>
<title name="">
<comments></comments>
<image>city.jpg</image>
<url>
</title>
<title name="">
<comments></comments>
<image>airport.jpg</image>
<url> </title>
</data>
here is AS
//Create the XML Object
myXML = new XML()
myXML.ignoreWhite = true
//Load XML file
myXML.load("bottom.xml")
//Make a reference to current timeline
myXML.ref = this
// Parse XML and fetch
myXML.onLoad = function(succes){
if(succes){
var root = this.firstChild
nodes = root.childNodes
for(var i=0; i<nodes.length; i++) {
this.ref["Title_txt"+i].text = nodes.attributes.name
subnodes = nodes.childNodes
this.ref["Comments_txt"+i].text = subnodes[0].firstChild.toString()
this.ref["holder_mc"+i].loadMovie(subnodes[1].firstChild.toString())
}
} else trace("Error loading XML document")
}
stop()
here is xml code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data[
<!ELEMENT title (comments, image)>
<!ATTLIST title name CDATA #REQUIRED>
<!ELEMENT comments (#PCDATA)>
<!ELEMENT image (#PCDATA)>
]>
<data>
<title name="">
<comments></comments>
<image>city.jpg</image>
<url>
</title>
<title name="">
<comments></comments>
<image>airport.jpg</image>
<url> </title>
</data>
here is AS
//Create the XML Object
myXML = new XML()
myXML.ignoreWhite = true
//Load XML file
myXML.load("bottom.xml")
//Make a reference to current timeline
myXML.ref = this
// Parse XML and fetch
myXML.onLoad = function(succes){
if(succes){
var root = this.firstChild
nodes = root.childNodes
for(var i=0; i<nodes.length; i++) {
this.ref["Title_txt"+i].text = nodes.attributes.name
subnodes = nodes.childNodes
this.ref["Comments_txt"+i].text = subnodes[0].firstChild.toString()
this.ref["holder_mc"+i].loadMovie(subnodes[1].firstChild.toString())
}
} else trace("Error loading XML document")
}
stop()