Skip to main content
Participant
August 26, 2020
Question

Data loaded from a remote web server not updating

  • August 26, 2020
  • 2 replies
  • 393 views

I've developed a Projector app which loads a 6 digit number (in a text file) from a remote web server when it opens.

 

The purpose of this is: I've hard coded a version number into the app, and it automatically compares this number against the latest version (stored as a 6 digit number) on the server. If the server number is higher, then it informs the user that a newer version of the app is available for download.

 

I'm using the following code which I think is fairly standard:

 

var url:String = "wwvv. URL GOES HERE/c-024.txt";
var loader:URLLoader = new URLLoader(new URLRequest(url));
loader.addEventListener(Event.COMPLETE, onFileLoaded);
function onFileLoaded(e:Event):void
{
    var loader:URLLoader = e.target as URLLoader;
    var loadedVersionText:String = loader.data;
    dataLoaded_txt.text=loadedVersionText;// This is a dynamic text box on the stage
}
 
(NOTE: THE URL ABOVE IS DELIBERATELY NOT VALID, SO THE POST ISN'T FLAGGED AS SPAM) 🙂
 
Initially, it works perfectly and loads c-024.txt. However, if I then change the number in this text file on the server, when I run the Animate projector again, it still shows the previous number and not the new updated number.

I've checked the file via a web browser and it has been updated. I've re-published the projector in the hopes that it will clear something, but it still shows the old number.
 
If I change the URL in the script to point to a new text document (eg c-025.txt), with the new number in it, it works perferctly again. It seems to only load the data once, after which it won't replace that data, even within newly published versions of the app or if I test the animation directly in Animate.
 
I'm guessing it's a cache issue or something and I need to clear or reset something, but I'm stuck.
 
I've used this method for many years in Flash, but this is my first time trying Animate. Am I doing something wrong ?
 
Many Thanks
Gary
 
 
    This topic is closed to new replies. Start a new post to keep the conversation going.

    2 replies

    GazCCAuthor
    Participant
    September 3, 2020

    Wow, you're a genius ! That worked perfectly Thank you so much !!!

     

    Sorry for the delay in my reply, I couldmn't find my post again on here after a few days. Was hoping Adobe would have put a "your posts" link somewhere on the site, but I don't think they have.

     

    Thanks again

    Gary

    kglad
    Community Expert
    Community Expert
    September 3, 2020

    in the future, to find your messages (and replies), click your adobe icon (at the screen's upper right) and then click "my profile"