# Loading multiple .txt files in a nested swf

**URL:** <https://forum.kirupa.com/t/loading-multiple-txt-files-in-a-nested-swf/255496>\
**Category:** Uncategorized\
**Created:** [March 23, 2008, 10:56pm UTC](https://forum.kirupa.com/t/loading-multiple-txt-files-in-a-nested-swf/255496 "2008-03-23T22:56:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pantagrel](https://avatars.discourse-cdn.com/v4/letter/p/3be4f8/32.png) [@pantagrel](https://forum.kirupa.com/u/pantagrel)\
**Post date:** [March 23, 2008, 10:56pm UTC](https://forum.kirupa.com/t/loading-multiple-txt-files-in-a-nested-swf/255496/1 "2008-03-23T22:56:11Z")

</div>

Hello–  
I have a swf (loader.swf) file with multiple buttons, each which loads its own external text file into still another swf with a text box; text.swf & text\_txt. This swf will be loaded into main.swf. Since there are so many buttons, I wanted to create a function which would load all the text files with this format:  
function loadText(myText:String){  
loader = new LoadVars();  
loader.onLoad = function() {  
\_root.text\_txt.text = this.myText;  
};  
bloader.load(“folder1/”+myText+".txt");  
}

This works when it’s hard-coded onto each button, but when the code is encapsulated in the function, I only get UNDEFINED in the text\_txt box.

Thanks for any help!
