# Dead simple but won't work, stupid textFormat

**URL:** <https://forum.kirupa.com/t/dead-simple-but-wont-work-stupid-textformat/54792>\
**Category:** Uncategorized\
**Created:** [June 17, 2004, 3:53pm UTC](https://forum.kirupa.com/t/dead-simple-but-wont-work-stupid-textformat/54792 "2004-06-17T15:53:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xMetal](https://avatars.discourse-cdn.com/v4/letter/x/c6cbf5/32.png) [@xMetal](https://forum.kirupa.com/u/xMetal)\
**Post date:** [June 17, 2004, 3:53pm UTC](https://forum.kirupa.com/t/dead-simple-but-wont-work-stupid-textformat/54792/1 "2004-06-17T15:53:41Z")

</div>

OK, I _know_ this is simple. I’ve read every thread on this board pertaining to this (including senocular’s Best Of thread), done everything there and this still doesn’t work and I can’t see why.

I feel like an idiot even asking, because I’ve seen the examples and lengthy tutorials.

All I want to do, is change the color of a dynamic text field when you press a button. But I want the name of the field to be a variable.

Now, this is what’s there:

1. the variable “\_root.expinttype1” is equal to “branch” and is set elsewhere.  
1a. There is an existing dynamic field called “branch” on screen.

2. On the button release I set the format:

expertText = new TextFormat();  
expertText.color = 0xFF0000;

1. then tell the stinking field to change.

this works --\> this[“branch”].setTextFormat(expertText);  
this works --\> this.branch.setTextFormat(expertText);  
this does not work --\> this["\_root.expinttype1"].setTextFormat(expertText);

Why? I set a dummy variable txt = \_root.expinttype1; and even threw it into a text field to verify the data, and it shows “branch”, so why doesn’t this work?

:jail:
