[external variables]Loading textformats from .txt files

Hello to all! I have just recently joined kirupa.com and am enjoying the multiple forum q&a’s and the tutorials around here. I want to make a small flash animation in which the user can specify what text and what font/color will be used throughout the animation, by typing in the text file.

On with the code which is of interest:


//Mouse.hide();
since1_txt = "";
since2_txt = "";
thename = "";
loadVariablesNum("banner.txt", 0);
myTextFormat = new TextFormat();
myTextFormat.align = left;
myTextFormat.color = 0xFFFFFF;
myTextFormat.font = Tahoma;
myTextFormat.size = 16;
myTextFormat2 = new TextFormat();
myTextFormat2.align = center;
myTextFormat2.color = 0xFFFFFF;
myTextFormat2.font = Tahoma;
myTextFormat2.size = 24;
myTextFormat3 = new TextFormat();
myTextFormat3.align = right;
myTextFormat3.color = 0xFF0000;
myTextFormat3.font = Tahoma;
myTextFormat3.size = 36;

Of course, the movie clips contain this text and all works fine if I specify it this way.

So I have this in my “actions” layer on the first frame and apart from the fact that it works if I specify the formatting within the actions, it’s all good. But now comes the fact that I want to specify my textformat options within the text (.txt) file. So I’d specify two color sets (in RGB hexa sets, 0xFF0000 for example), the font (in this case, tahoma) and the three sizes, and have them assigned to myTextFormat’s dynamically through loading, using, for example,

 
myTextFormat = new TextFormat();
myTextFormat.align = left;
myTextFormat.color = theColor1;
myTextFormat.font = theFont;
myTextFormat.size = theFormat1;

This is what the text file looks like:


since1_txt=Half-Life : Music-Making : Flash : HTML : Gaming
&since2_txt=Since 2000
&thename=cooleyo
&theFont=Impact
&theColor1=0xFF0000
&theColor2=0xFFFFFF
&theFormat1=16
&theFormat2=24
&theFormat3=36

Which doesn’t work because i can’t seem to get the myTextFormat.font = Tahoma; to work if i use myTextFormat.font = theFont; because it is, perhaps, searching for a font called “theFont” instead of taking the reference to the variable within the text file. Any help is appreciated!