rohanlatimer
rohanlatimer

Reputation: 23

AIR Android force Numeric Text Input

In as3, is it possible to force the numeric keypad entry to show on a textfield instead of the standard keyboard?

I have a textfield that the user will enter a price with, and it would be a nicer user experience. I know i can restrict the textfield input but would like that actual numeric pad to appear.

Upvotes: 2

Views: 3441

Answers (1)

bitmapdata.com
bitmapdata.com

Reputation: 9600

First, see a follow document.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/StageText.html#StageText%28%29

http://blogs.adobe.com/cantrell/archives/2011/09/native-text-input-with-stagetext.html

and refer a following code.

import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.geom.Rectangle;
import flash.text.ReturnKeyLabel;
import flash.text.SoftKeyboardType;
import flash.text.StageText;


var text:StageText = new StageText();
text.softKeyboardType = SoftKeyboardType.NUMBER;
text.restrict = "0-9";
text.returnKeyLabel = ReturnKeyLabel.GO;

text.stage = this.stage;
text.viewPort = new Rectangle(10, 10, 300, 40 );

Upvotes: 1

Related Questions