# Text format in input fields

**URL:** https://forum.kirupa.com/t/text-format-in-input-fields/135829
**Category:** Uncategorized
**Created:** [January 31, 2005, 12:06am UTC](https://forum.kirupa.com/t/text-format-in-input-fields/135829 "2005-01-31T00:06:35Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pastey](https://avatars.discourse-cdn.com/v4/letter/p/e36b37/32.png) [@pastey](https://forum.kirupa.com/u/pastey)
#### Post date: [January 31, 2005, 12:06am UTC](https://forum.kirupa.com/t/text-format-in-input-fields/135829/1 "2005-01-31T00:06:35Z")

</div>

I want to use a standard text format on a bunch of input and dynamic textboxes but only get the default settings: ie. it doesn’t apply the format.

Here’s a bit of the code. _ **Note** _ there is a new font in the library named “Font1” with the linkage identifier of “myFont” and set to export for actionscript and export in first frame

my\_fmt = new TextFormat();  
my\_fmt.font = “myFont”;  
my\_fmt.size = 25;  
my\_fmt.color = “0x00ffcc”;

this.createTextField(“input\_txt”, 1, 100, 100, 100, 30);  
input\_txt.type = “input”;  
//input\_txt.text= (" ");  
input\_txt.border = true;  
input\_txt.borderColor = “0x000000”;  
input\_txt.background = true;  
input\_txt.backgroundColor = “0xffffff”;  
input\_txt.setTextFormat(my\_fmt);  
input\_txt.variable = “input”;

this.createTextField(“final\_txt”, 2, 100,150, 100, 30);  
final\_txt.type = “dynamic”;  
final\_txt.border = true;  
final\_txt.borderColor = “0xFFFFFF”;  
final\_txt.background = true;  
final\_txt.backgroundColor = “0xBACACF”;  
final\_txt.variable = “final”  
final\_txt.setTextFormat(my\_fmt);

createEmptyMovieClip(“button\_mc”, 4)  
with(button\_mc){  
lineStyle(1, 0x000000, 100);  
beginFill(0x7C986B, 100);  
moveTo(210,100);  
lineTo(230,100);  
lineTo(230,120);  
lineTo(210,120);  
lineTo(210,100);  
endFill;  
}

button\_mc.onPress = function(){  
final = “’”+input+"’" + " said the Pig"  
}

The thing is I can get the format showing in the input box only if the line:  
//input\_txt.text= (" ");  
is unremed out (remove the //)  
but it’s not reliable as you have to click before the space.  
and I have yet to have it applied in the dynamic box.

Does anyone know of a better way to do this??

Thanks,  
Pastey.
