AS3: AIR Android: How to add an input text field?

181 Views Asked by At

I made a game that requires the player to type their answer. The following code is for the desktop version. I'm making a mobile version of the game and am having trouble with it. How can I code this so that the player can type their answer through touch events and tapping?

var answer:int;
answer = int(answer_txt.text)

1

There are 1 best solutions below

0
Yoones Mashayekhi On

simply add an inputbox to allow your users when touch it, add their answer

var textInput:TextField;
textInput.background = true;
textInput.restrict = "0-9";
textInput.autoSize = TextFieldAutoSize.CENTER;
textInput.antiAliasType = AntiAliasType.ADVANCED;
textInput.type = "input";
textInput.softKeyboard = SoftKeyboardType.NUMBER
addChild(textInput)

also you can use addTextFormat to change your font,and fontSize ,...