Getting started with text inputs and dynamic text fields using ActionScript 2.0 or 3.0

I know this is a simple question, but I haven’t worked very much with ActionScript ...

I know how to create a text input field using Flash. I can create it on stage and give it an instance name.

What is the code to capture the value of an input text field and display that value in a dynamic text field? How is this process different from ActionScript 2.0 and 3.0?

+5
source share
3 answers

It really depends on when you want to update the dynamic text field, with the text field input data.

, :

//AS3
myDynamicTF.text = myInputFT.text;

//AS2
myDynamicTF._text = myInputFT._text;

, , AS3 TextField Change event

//AS3
myInputFT.addEventListener(Event.CHANGE, changeHandler);

private function changeHandler(e:Event):void 
{
    myDynamicTF.text = myInputFT.text;
}

AS2 :

//AS2
myInputFT.onChanged = function(textfield_txt:TextField) 
{
    myDynamicTF._text = textfield_txt._text;
};
+4

, .as. .fla, -, Flash .as, . . Flash 8, .

+1

ActionScript, , , . .

ActionScript , :

import flash.events.*;
0

All Articles