display input text in ein anderes Textfeld in flash as3

Bitte helfen Sie mir...

Ich versuche zu zeigen, die Eingabe von text zu einem anderen text-Feld zur Laufzeit. Ich will zeigen das
myOutputBox mit in einem Film-clip. Der code ist unten:

Actionscript 3

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;

    }



}

}

Ist CaptureUserInput Ihre document-Klasse? Auch, wo hast myTextBox und myOutputBox kommen?

InformationsquelleAutor user1626744 | 2011-10-10

Schreibe einen Kommentar