# Access to Variables inside Class file

**URL:** <https://forum.kirupa.com/t/access-to-variables-inside-class-file/259233>\
**Category:** flash\
**Created:** [May 2, 2008, 9:48am UTC](https://forum.kirupa.com/t/access-to-variables-inside-class-file/259233 "2008-05-02T09:48:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kbd](https://avatars.discourse-cdn.com/v4/letter/k/e99b99/32.png) [@kbd](https://forum.kirupa.com/u/kbd)\
**Post date:** [May 2, 2008, 9:48am UTC](https://forum.kirupa.com/t/access-to-variables-inside-class-file/259233/1 "2008-05-02T09:48:21Z")

</div>

:skull:Hello,  
I’m trying to set up a class file that will read a bunch of links from an XML document so I can populate some buttons on the stage. The problem I am having is gaining access to the links within the class file. I have no clue how to get at “theWebsite” from the main document. Any help would be greatly appreciated!

This is what I have so far

Class file:

```auto
package {
    import flash.display.MovieClip;
    import flash.display.*;
    import flash.text.*;
    import flash.net.*;
    import flash.events.*;
 
    public class xmlLinkLoader{
        //VARIABLES & Event Listeners HERE
        trace("xml Link Loader CLASS Imported");
        public var theText:TextField;
        public var theWebsite:String;
        public var myWebsiteLink:String;
        public var myURLLoader:URLLoader= new URLLoader();
        public var xmlData:XML = new XML(); 
        public var myURLRequest:URLRequest= new URLRequest("links.xml");
        
        public function xmlLinkLoader() {
    
        myURLLoader.load(myURLRequest);
        myURLLoader.addEventListener(Event.COMPLETE,dataOK);
        }
        public function dataOK(myevent:Event):void {
            trace("xml loaded");
            xmlData = new XML(myevent.target.data); 
            for (var i=0; i<xmlData.splashlink.length(); i++) {
                var websiteLink = xmlData.splashlink.@theBandsWebsite;
            }
            
            populateMe();
            trace(websiteLink);
        }
        
        public function populateMe() {
            trace ("populated");
            var theWebsite = xmlData.splashlink.@theBandsWebsite;
    
        }
        
        //
        
    }
}

```

Document:

```auto
import xmlLinkLoader;
var myxmlLinkLoader= new xmlLinkLoader;

```
