Skip to main content
October 25, 2010
Answered

Text in flash?

  • October 25, 2010
  • 1 reply
  • 741 views

Hello!

Refering to my other thread "Actionscript 3 game problem" - http://forums.adobe.com/thread/740284?tstart=0

Here I want to ask about inputting text in a flash file.

Not the type where you choose the text tool and type in what ever text you want.

I want to create a dynamic textfield which allows the user to input text whilst running the flash-file.

I'll shortly explain the "idea".


Right now, I have my main game screen, a corridor.

In this corridor you can move around, though, only 1 step back & forth.

If you click one of the nine doors in the corridor you approach it with an animation.

This animation is done in a movieclip.

Within this animated movieclip, I have created the room where the user gets to "using" the door.

In the first room, the task is to type in the alphabet in correct order using the keyboard.

I am now wondering, how do I create this text field to be able to input text when running the game?

Thanks in advance!

This topic has been closed for replies.
Correct answer

import flash.text.TextField;

var tf:TextField=new TextField();
tf.type=TextFieldType.INPUT;
tf.text="enter text";

addChild(tf);

1 reply

Correct answer
October 25, 2010

import flash.text.TextField;

var tf:TextField=new TextField();
tf.type=TextFieldType.INPUT;
tf.text="enter text";

addChild(tf);

October 25, 2010

So this will allow the user to input text?

And after this, the only task is to create the listeners for the different keys allowed to be used?

After the user has typed in all the alphabet in the order he feels is correct, he is to click a correction button which checks wether or not it is in the correct order.

If yes, all the letters are to have a green light behind them.

If not, the letter that are wrong are supposed to have a red light and the correct ones green.

Will this work with your suggested solution?

October 25, 2010

So this will allow the user to input text?  -> Yes

And after this, the only task is to create the listeners for the different keys allowed to be used?  -> it depends on your coding logic.