;

PDA

Click to See Complete Forum and Search --> : cs4 URLLoader reset? xml question


gdoteof
11-22-2008, 10:48 PM
I am very new to flash and trying to learn to read and parse XML files.

it seems to work really elegantly except I have an issue with what seems to be caching that makes it hard to check my work.

var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();

xmlLoader.addEventListener(Event.COMPLETE, LoadXML);

xmlLoader.load(new URLRequest("http://www.somedomain.com/flashtest/list.xml"));

function LoadXML(e:Event):void {
xmlData = new XML(e.target.data);
trace(xmlData);
}

this works fine to load and trace the list.xml file on my server, however, if i edit list.xml, and then hit ctrl-enter to rerun the swf, the changes are not reflected in the program. in fact, i can delete list.xml off the server and it keeps tracing the the file that was originally loaded.

i have to actually close out my .fla file and reopen it to get it to update.

i am sure there is something silly i am missing but i have been messing with it for hours.

thanks for any help

cancerinform
11-23-2008, 03:08 PM
Try this. It will prevent caching:

var URL:String="http://www.somedomain.com/flashtest/list.xml";

if (Capabilities.playerType != "External" && Capabilities.playerType != "Standalone")
{
URL+= "?" + new Date + Math.floor(Math.random() * 10000);
}