Copy link to clipboard
Copied
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.
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.
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now