# Global variable help! seriously!

**URL:** <https://forum.kirupa.com/t/global-variable-help-seriously/67273>\
**Category:** Uncategorized\
**Created:** [October 14, 2004, 6:43am UTC](https://forum.kirupa.com/t/global-variable-help-seriously/67273 "2004-10-14T06:43:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjayK](https://avatars.discourse-cdn.com/v4/letter/j/d78d45/32.png) [@jjayK](https://forum.kirupa.com/u/jjayK)\
**Post date:** [October 14, 2004, 6:43am UTC](https://forum.kirupa.com/t/global-variable-help-seriously/67273/1 "2004-10-14T06:43:14Z")

</div>

Hi all, I got a global variable that I want to see the output for using trace.  
The problem is it comes out blank when I do trace. It gets it data from an xml file. I don’t see how it could not get data. If I put the trace inside the function it outputs a value but not outside the function. Must I make the function global or something? Please help!

```auto

_global.xValue;
_global.userInfo = new XML();
_global.userInfo.ignoreWhite = true;
_global.userInfo.load("[http://localhost/gBook/userInfo.xml](http://localhost/gBook/userInfo.xml)");
_global.userInfo.onLoad = function(success) {
 if(success)
 {
 var root = this.firstChild 
 var b=0;
			nodes = root.childNodes 
			for(var i=0; i<nodes.length; i++) {		 
				subnodes = nodes[0].childNodes 
				subnodes2 = nodes[1].childNodes
				subnodes3 = nodes[2].childNodes
				_global.xValue = subnodes[0].firstChild.toString() 
				_global.xValueOne = subnodes2[0].firstChild.toString()
			   _global.xValueOne2 = subnodes3[0].firstChild.toString()
	}
}

}
trace("Global x: " + _global.xValue);

```
