Using input text that's in a movie clip

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:

[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:

[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:

[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.

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

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

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

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

Can anyone help?

Thanks!

Miriam