# Loading button labels from an external text file

**URL:** https://forum.kirupa.com/t/loading-button-labels-from-an-external-text-file/275868
**Category:** flash
**Created:** [November 19, 2008, 4:57pm UTC](https://forum.kirupa.com/t/loading-button-labels-from-an-external-text-file/275868 "2008-11-19T16:57:44Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Skarab](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@Skarab](https://forum.kirupa.com/u/Skarab)
#### Post date: [November 19, 2008, 4:57pm UTC](https://forum.kirupa.com/t/loading-button-labels-from-an-external-text-file/275868/1 "2008-11-19T16:57:44Z")

</div>

I’ve got some code that draws a series of buttons. I’d like to label the buttons with an array that’s in an external text file. I’ve got this:

var patNumsArray:Array = new Array();

loadText = new LoadVars();  
loadText.onLoad = function(){  
this[“button”+i].textBox = this.patNum;  
}

patNumsArray.loadText.load(“patentNumbersText.txt”);

and then below I’ve got

var myFormat:TextFormat = new TextFormat();  
myFormat.align = “center”;  
myFormat.font = “Arial Bold”;  
myFormat.size = 16;  
myFormat.color = 0xFFFFFF;  
this[“button”+i].textBox.embedFonts = true;  
this[“button”+i].textBox.selectable = false;  
this[“button”+i].textBox.antiAliasType = “advanced”;  
this[“button”+i].createTextField(“textBox”, this[“button”+i].getNextHighestDepth(), 0, 2, this[“button”+i].\_width, this[“button”+i].\_height);  
this[“button”+i].textBox.text = patNumsArray\*;  
this[“button”+i].textBox.setTextFormat(myFormat);

But I can’t seem to get it to see the text file with the button names. Any help appreciated!
