Here's an example that uses the numeric keyboard and restricts the input to numbers:
package
{
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;
public class StageTextNumber extends Sprite
{
public function StageTextNumber()
{
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 );
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.