# Changing text in a textfield

**URL:** <https://forum.kirupa.com/t/changing-text-in-a-textfield/270662>\
**Category:** Uncategorized\
**Created:** [September 12, 2008, 3:57am UTC](https://forum.kirupa.com/t/changing-text-in-a-textfield/270662 "2008-09-12T03:57:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mleep](https://avatars.discourse-cdn.com/v4/letter/m/ea5d25/32.png) [@mleep](https://forum.kirupa.com/u/mleep)\
**Post date:** [September 12, 2008, 3:57am UTC](https://forum.kirupa.com/t/changing-text-in-a-textfield/270662/1 "2008-09-12T03:57:15Z")

</div>

My problem: I cannot get the text to change in a

```auto
txtField = passedObj.createTextField( "txt_Content", passedObj.getNextHighestDepth(), 40, 40, 200, 1000 );

txtField.text = "wheioaheiowa4";
txtField.embedFonts = true;
txtField.antiAliasType = "advanced";
txtField.sharpness = 300;
txtField._quality = "BEST";
txtField.selectable = false;
txtField.multiline = true;
txtField.autoSize = true;
txtField.wordWrap = true;
txtField.type = "dynamic";

var txt_Fmt:TextFormat = new TextFormat();
txt_Fmt.size = 16;
txt_Fmt.color = 0xFFFFFF; 
txt_Fmt.font = "Arial";
txtField.setTextFormat(txt_Fmt);

```

The following code works, but ONLY if it’s in the same class. If I call it on the textField from another class, it does not replace the text. Instead it displays “BLAH” above the old textField, but in the debugger does NOT create a new textField. (So you see “BLAH” and “wheioaheiowa4” overlapped).

```auto
txtField.replaceText( 0, txtField.text.length - 1, "BLAH");
txtField.replaceText( txtField.text.length-1, txtField.text.length, "");

```

ANY suggestions would be appreciated, or some good links to solid ways of manipulating dynamically created text.
