Call XML node with variable

I’m working on a newsboard for a site that I develop. I use an xml file for the news text. I loop out the news headers first, and then make them a link. When the link is clicked a as function starts. I send the node id to the function. The function is going to display the news text. It all works, the headers is displayd, and when I click on one of them the function starts, and I get the right id number when I trace it in the function.

But, when I use the id variable to call a childNode (childNode[id]), I just get the message “undefined”. If I insert a number instead (childNode[0]) it all works. Why can’t I use the variable “id”? Id does contain the number…

Here is the code:

[as2]
newsXML = new XML();
newsXML.ignoreWhite = true;
newsXML.onLoad = ladda;
newsXML.load(“news.xml”);

function ladda(success) {
//trace(“loaded”);
antal_news = 1;

for (i=0; i<antal_news; i++) {
if (newsXML.firstChild.childNodes* != null) {
news_text += “<a href=‘asfunction:test, “+i+”’>”+newsXML.firstChild.childNodes *.firstChild.firstChild.nodeValue+"</a><br />";
antal_news++;
}
else {
antal_news = 0;
}
}
}

function test(id:Number) {
trace(id);
news_text += newsXML.firstChild.childNodes[id].firstChild.firstChild.nodeValue+"<br />";
news_text += newsXML.firstChild.childNodes[id].firstChild.nextSibling.firstChild;
}
[/as2]