# Creating textfields

**URL:** <https://forum.kirupa.com/t/creating-textfields/225818>\
**Category:** flash\
**Created:** [May 16, 2007, 12:36am UTC](https://forum.kirupa.com/t/creating-textfields/225818 "2007-05-16T00:36:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimjiminyjimjim](https://avatars.discourse-cdn.com/v4/letter/j/aeb1de/32.png) [@jimjiminyjimjim](https://forum.kirupa.com/u/jimjiminyjimjim)\
**Post date:** [May 16, 2007, 12:36am UTC](https://forum.kirupa.com/t/creating-textfields/225818/1 "2007-05-16T00:36:42Z")

</div>

I have this code to start typing where I click the cursor on a movieclip:

```auto

_root.note.postit.onPress = function() {
xpos = _xmouse;
ypos = _ymouse;
_root.createTextField("my_txt", 1, xpos, ypos,(500-xpos),10);
my_txt.autoSize= true;
my_txt.multiline = true;
my_txt.wordWrap = true;
my_txt.type = "input";
var my_fmt:TextFormat = new TextFormat();
my_fmt.color = 0xFF0000;
my_txt.setTextFormat(my_fmt);
Selection.setFocus(_root.my_txt);
	
}

```

This works fine. But now I am trying to contain the new text field within a movieclip by doing something like this:

```auto

_root.note.postit.onPress = function() {
xpos = _xmouse;
ypos = _ymouse;
_root.note.createTextField("my_txt", 1, xpos, ypos,(500-xpos),10);
_root.note.my_txt.autoSize= true;
_root.note.my_txt.multiline = true;
_root.note.my_txt.wordWrap = true;
_root.note.my_txt.type = "input";
var my_fmt:TextFormat = new TextFormat();
_root.note.my_fmt.color = 0xFF0000;
_root.note.my_txt.setTextFormat(my_fmt);
Selection.setFocus(_root.note.my_txt);
	
}

```

This doesn’t work. Whats going wrong? Any help greatly appreciated.

Thanks
