Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loading Url From XML

Status
Not open for further replies.

afin

IS-IT--Management
Sep 18, 2010
1
0
0
GB
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()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top