# XML + getUrl always goes to last node

**URL:** <https://forum.kirupa.com/t/xml-geturl-always-goes-to-last-node/283406>\
**Category:** flash\
**Created:** [March 5, 2009, 6:28pm UTC](https://forum.kirupa.com/t/xml-geturl-always-goes-to-last-node/283406 "2009-03-05T18:28:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shurikn](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@shurikn](https://forum.kirupa.com/u/shurikn)\
**Post date:** [March 5, 2009, 6:28pm UTC](https://forum.kirupa.com/t/xml-geturl-always-goes-to-last-node/283406/1 "2009-03-05T18:28:22Z")

</div>

Hi everyone,  
I’m trying to load a url from an xml file and place that url on a button. It’s driving me insane.  
Here’s my code

```auto
myXML = new XML()
myXML.ignoreWhite = true
myXML.load("xml/nav_sub.xml")
myXML.ref = this 
myXML.onLoad = function(succes){

if(succes){ 
var root = this.childNodes[0];
nodes = root.childNodes;
shop_textbox_mc.swapDepths(_root.getNextHighestDepth());
var headlineFinal ="";

for(var j=0; j<nodes.length; j++) {  
duplicateMovieClip (shop_nav, "shop_nav" +j, j-9999);
}

for(var i=0; i<nodes.length; i++) {  
var prev_pos = getProperty("shop_nav"+i, _y)+(22*(i+1));
setProperty("shop_nav" + i, _y, prev_pos);
setProperty("shop_nav" + i, _alpha, 100);

_root.shop_subnav["shop_nav"+i].onRollOver = function() {this.gotoAndPlay("over");}
_root.shop_subnav["shop_nav"+i].onRollOut = function() {this.gotoAndPlay("out");}
_root.headline = this.childNodes[0].childNodes*.childNodes[0].firstChild.nodeValue.toUpperCase();
headlineFinal += _root.headline+"<br>";

_root.link = this.childNodes[0].childNodes*.childNodes[1].firstChild.nodeValue;
trace(_root.link);

_root.shop_subnav["shop_nav"+i].onRelease = function() {getURL(_root.link);};
}

shop_textbox_mc.shop_textbox.htmlText = headlineFinal;
}

else {
trace("Could not load XML file");
}
}

```

my trace values are correct, it’s giving me the right URL but once applied in the getUrl function, it’s ALWAYS going to the last node in my XML file.  
If I use something like the following it works but I can’t have HTML… ugh, please help!

```auto
"<a href='"+_root.link+"'>"+_root.headline+"</a><br>";

```
