# Preloader with text loop

**URL:** <https://forum.kirupa.com/t/preloader-with-text-loop/203321>\
**Category:** flash\
**Created:** [October 10, 2006, 6:12am UTC](https://forum.kirupa.com/t/preloader-with-text-loop/203321 "2006-10-10T06:12:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pherank](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pherank](https://forum.kirupa.com/u/Pherank)\
**Post date:** [October 10, 2006, 6:12am UTC](https://forum.kirupa.com/t/preloader-with-text-loop/203321/1 "2006-10-10T06:12:46Z")

</div>

I’m creating a preloader that loops through an array of adjectives and then stops on one of the words in the array. My code actually works, but, I also receive a “256 levels of recursion” error message in the Output dialog. That’s not so great. I wonder if anyone knows of a cleaner way to code this. (Note: I’m working in MX 2004.)

```auto
loadArray = new Array("vivid", "effervescent", "luminous", "powerful", "concise", "spontaneous", "mischievous", "radiant");
formatText = new TextFormat();
formatText.font = "Interstate-Regular";
formatText.size = 18;
formatText.color = "0xFFFFFF";
formatText.embedFonts = true;
formatText.selectable = false;
preload_txt.text = loadArray[0];
// Load first item in array
var elapsedSeconds:Number;
var n:Number = 0;
var nCount:Number = 0;
function loopText() {
    if (n<loadArray.length-1) {
        n++;
    } else {
        n = 0;
    }
    preload_txt.text = loadArray[n];
    preload_txt.autoSize = "right";
    preload_txt.setTextFormat(formatText);
    nCount++; // Let nCount reach 8 plus a random number between 1 and 7
    if (nCount>8+(Math.floor(Math.random()* 7 + 1))) {
        delete this.loopText();
    }
}
function initLoop() {
    countInt = setInterval(this, "loopText", 100);
}
initLoop();
stop();

```
