Skip to content Skip to sidebar Skip to footer

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

Solution 1:

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 = newStageText();
text.softKeyboardType = SoftKeyboardType.NUMBER;
text.restrict = "0-9";
text.returnKeyLabel = ReturnKeyLabel.GO;

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

Post a Comment for "Air Android Force Numeric Text Input"