# Trouble loading variables

**URL:** <https://forum.kirupa.com/t/trouble-loading-variables/21179>\
**Category:** flash\
**Created:** [May 18, 2003, 4:05pm UTC](https://forum.kirupa.com/t/trouble-loading-variables/21179 "2003-05-18T16:05:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgroff](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@mgroff](https://forum.kirupa.com/u/mgroff)\
**Post date:** [May 18, 2003, 4:05pm UTC](https://forum.kirupa.com/t/trouble-loading-variables/21179/1 "2003-05-18T16:05:46Z")

</div>

Hey,  
I’m attempting to load a variable from a text file and it’s always being traced as empty. What I’m trying to do is load an RGB value from a text file so that I can modify text color on the fly. Do I need to make a movie clip of my text box or anything? I’m generating the text on the fly with code. Thanks.

mg

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 18, 2003, 4:23pm UTC](https://forum.kirupa.com/t/trouble-loading-variables/21179/2 "2003-05-18T16:23:34Z")

</div>

a/make sure the txtfile is loaded before trying to access the var  
b/how is it coded?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 18, 2003, 4:30pm UTC](https://forum.kirupa.com/t/trouble-loading-variables/21179/3 "2003-05-18T16:30:14Z")

</div>

it is done by the following on frame 1:  
loadVariables(“include.txt”, this);

i’ve also tried loadvariablesnum(“include.txt”,0)

the next frame has the following code:  
if (textColorB != undefined ) {  
gotoAndPlay(4);  
}

textColorA is my variable from the include and it’s checking to see if the variable is loaded yet

frame 3 just says go back to frame 2.

frame 4 has the following code:

trace(textColorB);

sColor = textColorB;  
trace(“scolor=” + sColor);  
nColor = parseInt(sColor, 16);  
this.createTextField(“tfNewfield”,1,-.5,7.1,120.5,20.8);  
tfNewfield.text = “No More Junk”;  
tfNewfield.textColor = ncolor;  
tfNewfield.border = false;  
fmtEmphasis = new TextFormat();  
fmtEmphasis.bold = true;  
fmtEmphasis.size = 15;  
fmtEmphasis.font = “Arial”;  
fmtEmphasis.color = nColor;  
fmtEmphasis.align = “Center”;  
tfNewfield.setTextFormat(fmtEmphasis);

stop();

basically just generating my text box which always comes out black even though the rgb value in the include is a blue. also every trace comes back undefined. it’s not a very big text file but it just doesn’t seem to work. i’ve tested and put the contents of the variable in a dynamic text box and that works ok, but i can’t access the variable as a true variable it seems.

thanks for any help.  
mg
