# Issue With Accessing Static Class Var in Main Timeline

**URL:** <https://forum.kirupa.com/t/issue-with-accessing-static-class-var-in-main-timeline/245110>\
**Category:** flash\
**Created:** [November 26, 2007, 3:28pm UTC](https://forum.kirupa.com/t/issue-with-accessing-static-class-var-in-main-timeline/245110 "2007-11-26T15:28:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gphilly77](https://avatars.discourse-cdn.com/v4/letter/g/5e9695/32.png) [@gphilly77](https://forum.kirupa.com/u/gphilly77)\
**Post date:** [November 26, 2007, 3:28pm UTC](https://forum.kirupa.com/t/issue-with-accessing-static-class-var-in-main-timeline/245110/1 "2007-11-26T15:28:01Z")

</div>

I have a small class that I have created to return values from an xml file.

The var named menuLink1 is set in the LoadXML func and can be traced from the main timeline. However when I try to set the var in the SetMenuVals func and trace it from the main timeline, it returns null. Can’t see why this happens…

**Main Timeline:**  
import com.ffi.MenuItems;  
var mainLinks:MenuItems = new MenuItems(“menuData.xml”);  
trace(mainLinks.getMenuLink1());

**Class**  
package com.ffi  
{  
import fl.data.DataProvider;  
import [flash.net](http://flash.net)._;  
import flash.events._  
import flash.xml.\*

public class MenuItems  
{  
public static var fileName:String;  
public static var menuLink1:String;  
private static var xmlLoader:URLLoader;

public static function setMenuLink1(value:String):void{  
menuLink1 = value;  
}  
public static function getMenuLink1():String{  
return menuLink1;  
}  
//constructor  
public function MenuItems(fName:String){

```
     fileName = fName;
     LoadXML();

```

}

public static function LoadXML():void{  
xmlLoader = new URLLoader();  
var req:URLRequest = new URLRequest(fileName);  
xmlLoader.load(req);  
xmlLoader.addEventListener(Event.COMPLETE, SetMenuVals);  
setMenuLink1(“Home”);  
}

public static function SetMenuVals(eventObj:Event):void {  
//var countriesXML = new XML(eventObj.currentTarget.data);  
//countries = countriesXML.children()[0].children();  
//var menuXML:XML = new XML(xmlLoader.data);

//set links  
setMenuLink1(“Home”);  
//trace(menuXML.children()[0].attributes()[0].toXMLString());

}
