How to use varible inside function elsewhere?

Hello,

This is a newbie question (and so am I) but i havn´t found the answer anywhere and I would gladly appreciate som help!

This is what I am trying to do:

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
[COLOR=Red] image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
p = image*;[/COLOR]
}
firstImage();
} else {
content = “file not loaded!”;
}
}

[COLOR=Red]trace§

[COLOR=Black]how come p is undefined? is there a way to make the variable global and useable outside the function?

I am basically trying to use the tutorial for loading external pictures from an XML file found here on kirupa, and get it to assign a number to every picture and load the latest addition.

So when a PHP program updates the XML file, the flash will load that latest added picture.

Thank you very much for your help and time!
[/COLOR][/COLOR]