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

Preload Text from an External Site

New Here ,
Aug 31, 2013 Aug 31, 2013

I am using this actionscript multiple times within a document:

var loader1:URLLoader = new URLLoader(new URLRequest("http://www.url.com/example.txt"));

loader1.addEventListener(Event.COMPLETE, completeHandler);

function completeHandler(event:Event):void {

var loadedText1:URLLoader = URLLoader(event.target);

Box.text = loadedText1.data;

}

Unfortunately, there tends to be a significant lag in terms of this text appearing. How can I get flash to cache these text files before it called upon to display them? -- kinda like a pre loader for text files.

TOPICS
ActionScript
384
Translate
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

correct answers 1 Correct answer

LEGEND , Sep 01, 2013 Sep 01, 2013

The time it takes to download the file is the time it takes, and the code you show is dealing with it as soon as it has been downloaded.  To cache it before it is called upon to display them you need to do everything but that last line of code ahead of time.  Load the data and store it somewhere so that you can assign it when it needs to be assigned.

Translate
LEGEND ,
Sep 01, 2013 Sep 01, 2013
LATEST

The time it takes to download the file is the time it takes, and the code you show is dealing with it as soon as it has been downloaded.  To cache it before it is called upon to display them you need to do everything but that last line of code ahead of time.  Load the data and store it somewhere so that you can assign it when it needs to be assigned.

Translate
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