Web design and coding samples, free tools, tips and more..
Untitled Document

PostHeaderIcon How to delete xml cache with actionscript?

İt’s important to delete xml cache in flash if your content is renewing it self often.  Here’s the sample code for deleting xml cache with actionscript;

Just change your xml loading code with this:

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
myAdd=Math.round(Math.random()*10000); // producing random numbers to add after filename
myXmlFile=”myfile.xml?new=”+myAdd;  // little trick to pass the browser cache, it thinks this is a new file ..
xmlData.load(myXmlFile);

With this code your flash will reload your xml file refreshing everytime.

  • Share/Bookmark

4 Responses to “How to delete xml cache with actionscript?”

  • Polprav says:

    Hello from Russia!
    Can I quote a post in your blog with the link to you?

  • yuzi says:

    It’s ok, thanks for asking :)

  • Erik says:

    That is what I am lookig for!.. but, I get this error:

    Error opening URL “file:///C|/Documents%20and%20Settings/Compaq%5FEigenaar.UW%2D4B58D8528225/Bureaublad/VAVOUM/bloemsierkunst.xml?new=9498″

    the .xml file isn’t named ….?new=9498

    So.. how does flash find the xml file then?

  • yuzi says:

    it should work well on server, in local (on your computer) this piece of code not work :)

Leave a Reply

Spam Protection by WP-SpamFree

Search