Hi all,
I’m trying to pull a URL from an xml file, but have come up against a problem that I cannot solve.
The XML looks like this:
<photos>
−
<photo>
<thumb src="http://www.videoemporiumdelivery.co.uk/test/images/fronts/5591.jpg"/>
<img src="http://www.videoemporiumdelivery.co.uk/test/images/backs/5591a.jpg"/>
<caption text="Angels and Demons"/>
<link src="http://www.imdb.com/find?s=tt&q=Angels+and+Demons&x=0&y=0"/>
−
<desc>
Tom Hanks returns as Da Vinci Code breaker Robert Langdon, this time saving the Catholic Church from a terrorist attack on the Vatican in Ron Howard's adaptation of the Dan Brown blockbuster.<br><br><a href="event:http://www.imdb.com/find?s=tt&q=Angels+and+Demons&x=0&y=0" rel="shadowbox"> More</a>
</desc>
</photo>
or check it out here, if the formatting above has made it hard to read
http://www.videoemporiumdelivery.co.uk/CodeIgniter/xml/justin
I have this piece of code earlier on, which I believe, creates the array, :
{
thumb* = dat.photos.photo.thumb.attributes()*;
capt* = dat.photos.photo.caption.attributes()*;
desc* = dat.photos.photo.desc.text()*;
link* = dat.photos.photo.link.attributes()*;
img* = dat.photos.photo.img.attributes()*;
}
then I have a function which is executed when an image is clicked:
private function opentitlepage()
{
arguments;
var myURL:URLRequest = new URLRequest(link[cID]);
trace (link[cID]);
navigateToURL(myURL,"blank");
}
Which should obviously open up the URL within the ‘link’ attirbute of the xml
I put the trace in there to see if I could track down the problem, it is tracing ‘(link[cID])’ as 'undefined, which explains why it is not working.
However, if i change it to
var myURL:URLRequest = new URLRequest(img[cID]);
then clicking on the image opens in a new tab, as expected.
Then I changed that part back to how it was originally, and changed
link* = dat.photos.photo.link.attributes()*;
to
link* = dat.photos.photo.img.attributes()*;
and that gives me the same result, so I cannot undersatnd why it does not work for the link attribute in the xml?
I’m sure it’s something very simple I’m missing, can anyone help?