我正在尝试为我的AIR应用程序实现Stagetext输入,我遇到了一个巨大的错误。
当我输入输入框时,例如“test”字符开始重复,当我尝试删除它们时,它们会一直重复。
有解决方法吗?我是否应该将Stagetext用于原生输入?
以下代码
function login()
{
var usernameBox = new Sprite();
var passwordBox = new Sprite();
var usernameInput:StageText = new StageText();
var passwordInput:StageText = new StageText();
usernameBox.graphics.lineStyle(4, 0x000000, 1);
usernameBox.graphics.beginFill(0xFFFFFF, 1);
usernameBox.graphics.drawRect(6, 44, stage.stageWidth-12, 70);
this.addChild(usernameBox);
passwordBox.graphics.lineStyle(4, 0x000000, 1);
passwordBox.graphics.beginFill(0xFFFFFF, 1);
passwordBox.graphics.drawRect(6, 130, stage.stageWidth-12, 70);
this.addChild(passwordBox);
usernameInput.returnKeyLabel = ReturnKeyLabel.DONE;
usernameInput.autoCorrect = true;
usernameInput.restrict = "a-zA-Z0-9_\\-";
usernameInput.fontSize = 40;
usernameInput.color = 0x440000;
usernameInput.stage = stage;
usernameInput.viewPort = new Rectangle(10,50,stage.stageWidth-20,70);
passwordInput.returnKeyLabel = ReturnKeyLabel.DONE;
passwordInput.autoCorrect = false;
passwordInput.restrict = "a-zA-Z0-9_\\-";
passwordInput.fontSize = 40;
passwordInput.color = 0x440000;
passwordInput.displayAsPassword = true;
passwordInput.stage = stage;
passwordInput.viewPort = new Rectangle(10,136,stage.stageWidth-20,70);
}