# Dynamic text field

**URL:** <https://forum.kirupa.com/t/dynamic-text-field/57038>\
**Category:** flash\
**Created:** [July 9, 2004, 6:19pm UTC](https://forum.kirupa.com/t/dynamic-text-field/57038 "2004-07-09T18:19:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![markP](https://avatars.discourse-cdn.com/v4/letter/m/b3f665/32.png) [@markP](https://forum.kirupa.com/u/markP)\
**Post date:** [July 9, 2004, 6:19pm UTC](https://forum.kirupa.com/t/dynamic-text-field/57038/1 "2004-07-09T18:19:09Z")

</div>

The first piece of code creates a textField and the second piece is on a button on the root level of my movie trying to write to it. It doesn’t seem to work, any ideas why?

```auto
createTextField("my_txt", 1, 150, textDepth, 0, 0);
with (my_txt) {
	_width = 150;
	autoSize = "left";
	multiline = true;
	wordWrap = true;
	selectable = false;
}
// 
// 
myformat = new TextFormat();
myformat.variable = "my_txt";
myformat.type = dynamic;
myformat.color = 0xffffff;
myformat.size = 14;
myformat.font = "Arial";
myformat.bold = true;
myformat.leading = 4;
myformat.wordWrap = true;
my_txt.setTextFormat(myformat);

```

```auto
textButtons.my_txt.text = "hello2";

```

---

<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:** [July 9, 2004, 7:21pm UTC](https://forum.kirupa.com/t/dynamic-text-field/57038/2 "2004-07-09T19:21:15Z")

</div>

on the frame:

```auto

createTextField("my_txt", 1, 150, textDepth, 0, 0);
with (my_txt) {
_width = 150;
autoSize = "left";
multiline = true;
wordWrap = true;
selectable = false;
}
// 
// 
myformat = new TextFormat();
myformat.variable = "my_txt";
myformat.type = dynamic;
myformat.color = 0xffffff;
myformat.size = 14;
myformat.font = "Arial";
myformat.bold = true;
myformat.leading = 4;
myformat.wordWrap = true;
my_txt.setTextFormat(myformat);

```

on the button:

```auto

on (release){
 my_txt.text = "hello2";
}

```

i put that in and it worked fine.

---

<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:** [July 10, 2004, 11:14am UTC](https://forum.kirupa.com/t/dynamic-text-field/57038/3 "2004-07-10T11:14:44Z")

</div>

Thank you very much… that did it.
