Prevent XML caching problem

When load xml files by URLLoaders, they are often cached by the browsers and do flash is unable to display the updated data. This is a very common problem & I always find this some where around me once in a month or so. Even my friends do face the same issue.

There is a very simple solution to this cute little problem. When ever you are loading by URLLoader.load method just add a time stamp to the URLRequest and everything will work fine except you might get some error message while compiling the swf.(“Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL”). You can ignore it and continue publishing. On the web it will not throw any such error- believe me.

Here is the little rabbit:

  1. var xmlPath:String="replaceYourXMLPathHere.xml"
  2. var urlReq:URLRequest = new URLRequest(xmlPath+"?time=" + new Date().getTime());

Let me know if the readers have some other idea..

This entry was posted in AS3. Bookmark the permalink.

3 Responses to Prevent XML caching problem

  1. attonbomb says:

    Thank you so much this has been seriously twisting my melon for quite a while.

    God Bless

  2. Ellouze Ahmed Said says:

    Thank you very mutch ! :)
    this helped me to get out of a serious problem..

  3. ZenekZezool says:

    Thank You so much! I couldn’t find any answer why my php request gives me always the same data despite I update rows in database! Now it’s working ;)

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>