# loadVars

**URL:** <https://forum.kirupa.com/t/loadvars/284491>\
**Category:** Uncategorized\
**Created:** [March 19, 2009, 4:54pm UTC](https://forum.kirupa.com/t/loadvars/284491 "2009-03-19T16:54:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)\
**Post date:** [March 19, 2009, 4:54pm UTC](https://forum.kirupa.com/t/loadvars/284491/1 "2009-03-19T16:54:42Z")

</div>

I trying to load in a text file from XML through a for loop, as each node from the xml is attached to the stage, with its own piece of text in its text box.

To do this I am using loadVars, which when onLoad occurs, the text file is placed into its relevant place.

What goes wrong with my code, is that ONLY the last node in the for loop loads in the text file. As if everytime the loadvars is created within the loop, it irradicates the last made, not giving a chance for any of the others to actually load the text. But I cant think of another way to create a ‘new’ named ‘textData’ variable in each loop.

Have a look at the code to see how I am doing this:  
Can anyone point out my error?

```auto
for (i=0;i<total;i++)
    {
        News* = xmlNode*.attributes.News;
        menu = container.attachMovie("volume","volume"+i,i,{_y:i*50});
                
        var textData:LoadVars = new LoadVars();
        textData.onLoad = function()
        {
            menu.content_txt.htmlText = this.content;
        }
        textData.load(News*);
}

```

Thanks!
