# Using input text that's in a movie clip

**URL:** https://forum.kirupa.com/t/using-input-text-thats-in-a-movie-clip/326747
**Category:** flash
**Created:** [January 9, 2012, 8:04pm UTC](https://forum.kirupa.com/t/using-input-text-thats-in-a-movie-clip/326747 "2012-01-09T20:04:32Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![imhappe](https://avatars.discourse-cdn.com/v4/letter/i/da6949/32.png) [@imhappe](https://forum.kirupa.com/u/imhappe)
#### Post date: [January 9, 2012, 8:04pm UTC](https://forum.kirupa.com/t/using-input-text-thats-in-a-movie-clip/326747/1 "2012-01-09T20:04:32Z")

</div>

Hi all -

Tearing my hair out on this, and it seems like it shouldn’t be that difficult.

I’ve got an input text box (opAnswerTxt) that I’ve added to a movie clip (questAns) using AS3:

```auto
[FONT=courier new]questAns.addChild(opAnswerTxt);[/FONT]

```

That’s fine – I’m able to type text into the text field. Now I need to trace this text. (Ultimately, I will want to capture the text in a variable and then reuse the text in a dynamic text field, but just tracing to make sure I can get the text first.)

I added a button (opSaveBtn) - also to the MC - and added an event listener to the button:

```auto
[FONT=courier new]questAns.addChild(opSaveBtn);[/FONT]
[FONT=courier new]opSaveBtn.addEventListener(MouseEvent.CLICK, saveOpInput);[/FONT]

```

but can’t seem to trace the input text. Here’s what I’m using:

```auto
[FONT=courier new]function saveOpInput(me:MouseEvent):void[/FONT]
[FONT=courier new] {[/FONT]
[FONT=courier new] trace (opAnswerTxt.text);[/FONT]
[FONT=courier new]}[/FONT]

```

My output is the original default text I have in the text box, rather than the text I just typed in.

When I add the input text box to the stage, rather than to the MC, it works fine.

Note: I’ve tried targeting the instance – see the following – but I get an error.

```auto
[FONT=courier new]trace (questAns.opAnswerTxt.text);[/FONT]

```

[FONT=arial][/FONT]  
[FONT=arial]Also tried:

```auto
[FONT=courier new]trace (MovieClip(root).questAns.opAnswerTxt.text);
[/FONT]

```

and that didn’t work either.[/FONT]

Can anyone help?

Thanks!

Miriam
