AIR Android强制数字文本输入 [英] AIR Android force Numeric Text Input

查看:95
本文介绍了AIR Android强制数字文本输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在as3中,是否可以强制数字小键盘条目显示在文本字段而不是标准键盘上?

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.

推荐答案

首先,请参阅以下文档。

First, see a follow document.

http://help.adobe.com/zh_CN/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

并参考以下代码。

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 );

这篇关于AIR Android强制数字文本输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆