Weather program: global vars?

Hey guys, it’s my first post… yay :hr:

Anyways, I’m currently making this small weather program using actionscript. It loads XML files from the National Weather Service web site and interprets the information in the following ways:

[list]
[]the current temp and text condition readout (Partly Cloudy) is printed into 2 dynamic text boxes. this works fine.
[/list]
[list]
[
]i have a bunch of IF statements to translate the text conditions to display an image file --> if (printout_txt=“Partly Cloudy”){ show clouds image; }
[/list] here’s an example:

function loadXML (loaded) {
if (loaded) {
degrees_txt.text = xmlData.firstChild.childNodes[13].firstChild.nodeValue + " F"
printout_txt.text = xmlData.firstChild.childNodes[11].firstChild.nodeValue
}
}

xmlData = new XML ()
xmlData.ignoreWhite = true
xmlData.onLoad = loadXML
xmlData.load(“http://weather.gov/data/current_obs/KSHD.xml”)

if (printout_txt == “Mostly Cloudy”)
{
imageURL = “http://weather.gov/weather/images/fcicons/bkn.jpg”;
}

**For some reason, actionscript doesn’t detect printout_txt from inside the function. What do I need to do in order to get the image to show, assuming that it’s “Mostly Cloudy” outside?

Do i have to declare printout_txt.text a global variable? If so, how?

In the ‘for’ loop, is it right to say ‘printout_txt’, or should it be ‘printout_txt.text’ instead?**

Thanks for reading.
Matt