# Making text appear in two boxes at the same time

**URL:** https://forum.kirupa.com/t/making-text-appear-in-two-boxes-at-the-same-time/235252
**Category:** flash
**Created:** [August 9, 2007, 5:30pm UTC](https://forum.kirupa.com/t/making-text-appear-in-two-boxes-at-the-same-time/235252 "2007-08-09T17:30:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bt30](https://avatars.discourse-cdn.com/v4/letter/b/8797f3/32.png) [@bt30](https://forum.kirupa.com/u/bt30)
#### Post date: [August 9, 2007, 5:30pm UTC](https://forum.kirupa.com/t/making-text-appear-in-two-boxes-at-the-same-time/235252/1 "2007-08-09T17:30:10Z")

</div>

Hi,  
I am trying to work out a solution in Flash for making text input appear in two text boxes at the same time, hopefully in realtime.

Preferably I want to use actionscript 2 but I am willing to use either.

I know for a start I need to set the textbox to Input Text.

I found in the help for AS3 the section -\> Programming ActionScript 3.0

Working with text \> Capturing text input

However when I use this code it gives me the error “package cannot be nested”

Thanks for any suggestions/help it is really appreciated!

Here is the code in the help file:  
package  
{  
import flash.display.Sprite;  
import flash.display.Stage;  
import flash.text._;  
import flash.events._;  
public class CaptureUserInput extends Sprite  
{  
private var myTextBox:TextField = new TextField();  
private var myOutputBox:TextField = new TextField();  
private var myText:String = “Type your text here.”;  
public function CaptureUserInput()  
{  
captureText();  
}

```
    public function captureText():void
    {
        myTextBox.type = TextFieldType.INPUT;
        myTextBox.background = true;
        addChild(myTextBox);
        myTextBox.text = myText;
        myTextBox.addEventListener(TextEvent.TEXT_INPUT, textInputCapture);
    }
    
    public function textInputCapture(event:TextEvent):void
    {
        var str:String = myTextBox.text;
        createOutputBox(str);
    }
        
    public function createOutputBox(str:String):void
    {
        myOutputBox.background = true;
        myOutputBox.x = 200;
        addChild(myOutputBox);
        myOutputBox.text = str;
    }
    
}

```

}

[http://livedocs.adobe.com/flash/9.0/main/00000227.html](http://livedocs.adobe.com/flash/9.0/main/00000227.html)
