# XML Refresh working locally but not online

**URL:** <https://forum.kirupa.com/t/xml-refresh-working-locally-but-not-online/290736>\
**Category:** flash\
**Created:** [June 18, 2009, 8:37pm UTC](https://forum.kirupa.com/t/xml-refresh-working-locally-but-not-online/290736 "2009-06-18T20:37:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alpha\_Remex](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@Alpha\_Remex](https://forum.kirupa.com/u/Alpha_Remex)\
**Post date:** [June 18, 2009, 8:37pm UTC](https://forum.kirupa.com/t/xml-refresh-working-locally-but-not-online/290736/1 "2009-06-18T20:37:28Z")

</div>

So I have an incredibly simple tool that shows some updates from an XML file…

In the swf, there is a button that triggers a refresh for the XML file… it works fine locally, but not online…

Any ideas?

```auto

stop();

btnRefresh.label = "Refresh";

var dbURL:URLRequest = new URLRequest("file.xml");    
var dbLoader:URLLoader = new URLLoader();
var inventoryDatabase:XML;
var outputString:String;

//Listen for data to finish loading
dbLoader.addEventListener(Event.COMPLETE, completeListener);

//Load the database
dbLoader.load(dbURL);            

//Function activates when loading is complete
function completeListener(e:Event):void {
    
    //Remove load listener
    dbLoader.removeEventListener(Event.COMPLETE, completeListener);
    
    //Assign the database
    inventoryDatabase = new XML(dbLoader.data);
    btnRefresh.addEventListener(MouseEvent.CLICK, refreshHandler);
    
    for each(var conf:XML in inventoryDatabase.*) {
        switch(conf.@id.toString()){
            
            case "1":
                for each(var item:XML in conf.*) {
                    if(item.@name.toString() == "stock") {
                        outputString = item.toString();
                        config1Stock.text = outputString;
                    } else {
                        outputString = item.toString();
                        config1IP.text = outputString;
                    }
                }
                config1Total.text = (int(config1Stock.text) + int(config1IP.text)).toString();
                break;
            case "4":
                for each(var item2:XML in conf.*) {
                    if(item2.@name.toString() == "stock") {
                        outputString = item2.toString();
                        config4Stock.text = outputString;
                    } else {
                        outputString = item2.toString();
                        config4IP.text = outputString;
                    }
                }
                config4Total.text = (int(config4Stock.text) + int(config4IP.text)).toString();
                break;
        }
    }
}

function refreshHandler(e:MouseEvent=null):void {
    inventoryDatabase=null;
    dbLoader=null;
    dbURL = new URLRequest("file.xml");    
    dbLoader = new URLLoader();
    
    //Listen for data to finish loading
    dbLoader.addEventListener(Event.COMPLETE, completeListener);
    
    //Load the database
    dbLoader.load(dbURL);
}

```
