# Text file from server

**URL:** https://forum.kirupa.com/t/text-file-from-server/288263
**Category:** flash
**Created:** [May 13, 2009, 3:04pm UTC](https://forum.kirupa.com/t/text-file-from-server/288263 "2009-05-13T15:04:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![zietguest](https://avatars.discourse-cdn.com/v4/letter/z/e79b87/32.png) [@zietguest](https://forum.kirupa.com/u/zietguest)
#### Post date: [May 13, 2009, 3:04pm UTC](https://forum.kirupa.com/t/text-file-from-server/288263/1 "2009-05-13T15:04:34Z")

</div>

Hi.

I have an issue with a script I created that loads text strings from a file on my server.  
The swf file loads a message from a .txt file, displays it in an animation when the animation finishes it loops back to the start and loads the next message and displays it in the animation.

All works fine. However the script reads the text file from the server on every loop ( 3 seconds ) This will be hard on my server so… Is there a way to read the text file once only and then loop through the eight statements?

Thanks. Z

Actionscript 2. Flash CS3. Flash Player 10.  
quotes.txt - text file containing eight quotes  
quote\_txt - Dynamic field within animation

```auto
ranQuote = new LoadVars();
ranQuote.onLoad = function(success) {
    if (success) {
        RanNum = RanNum+1;
        if (RanNum>=9) {
            RanNum = 1;
            ran = this["quote"+(RanNum)];
            quote_txt.text = ran;
        } else {
            ran = this["quote"+RanNum];
            quote_txt.text = ran;
        }
    } else {
        quote_txt.text = "Display if can't load txt file";
    }
};
ranQuote.load("quotes.txt");

```
