Hi
I’ve already posted this in AS2 but I think its AS3
I followed a tutorial about loading data into Flash using xml. Everything works perfectly but I would like to add hyper links to the images.
Any ideas?
I’m new to this and trying to work it out. I’m presuming I need to add:
this.ref[" …something here… "+i].getURL(subnodes[2].firstChild.toString())
but its out of my zone at the moment.
Here is the ActionScript
//Create the XML Object
myXML = new XML()
myXML.ignoreWhite = true
//Load XML file
myXML.load(“anastasio.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()
and the xml
<?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=“Whats New”>
<comments>the summer is here and so are our lightest summer dresses…
</comments>
</title>
<title name="">
<comments>Photo Shoot movie
</comments>
<image>an1.jpg</image>
</title>
<title name="">
<comments>Jersey bling dress, brown
</comments>
<image>an2.jpg </image>
</title>
<title name="">
<comments>Bubble dress, smudge rose and hot flowerk
</comments>
<image>an3.jpg</image>
</title>
<title name=“Our lookbook”>
<comments>View this seaons look book
</comments>
<image>an4.jpg</image>
</title>
<title name="">
<comments>Send us your photos
</comments>
<image>an5.jpg</image>
</title>
<title name="">
<comments>Ying yang dress, hot pink
</comments>
<image>an6.jpg</image>
</title>
<title name="">
<comments>New yorker playsuit, shell pink
</comments>
<image>an7.jpg</image>
</title>
<title name=“Bridesmaid lookbook”>
<comments>Bridesmaid collection
</comments>
<image>an8.jpg</image>
</title>
</data>