• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Prevent Cache

Community Expert ,
Apr 25, 2008 Apr 25, 2008

Copy link to clipboard

Copied

I'm hoping someone can help me with a method to prevent loaded text or html files from being cached. In AS2 I used something like this:
_PageLoad.load("MyTextFile.html?r="+new Date().getTime());

I can't figure out how to get that to work with URLRequest. The sample code is a class which creates a text field and loads an html or text file from the first parameter. Thanks
TOPICS
ActionScript

Views

556

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 26, 2008 Apr 26, 2008

Copy link to clipboard

Copied

append r to _URL.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 26, 2008 Apr 26, 2008

Copy link to clipboard

Copied

Thanks. I was getting an error when I tried that and realized it was only a problem when I tested locally. I probably can live with that, but would there be a way to stop the error when I test from Flash?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 26, 2008 Apr 26, 2008

Copy link to clipboard

Copied

not that i know about. in the local file system appended variables look like part of the file name.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 28, 2008 Apr 28, 2008

Copy link to clipboard

Copied

You can test for the file system using the url property of a LoaderInfo
instance, and construct the string accordingly.

var li:LoaderInfo;
li = aDisplayObjectOnStage.loaderInfo;
// OR
li = aDisplayObjectOnStage.stage.loaderInfo;

var textFileUrl:String = "MyTextFile.html" +
li.url.indexOf("file:")==0 ? ""
: ("?r=" + new Date().getTime().toString());

_PageLoad.load(textFileUrl);





Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 28, 2008 Apr 28, 2008

Copy link to clipboard

Copied

LATEST
Thanks Raymond, I'll try that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines