0

I am trying to implement Stagetext inputs for my AIR app and I am encountering a huge bug.

When I type in the input box, for example "test" characters start to repeat themselves and when I try to delete them, they keep duplicating.

Is there a fix for this? Should I even be using Stagetext for native inputs?

Code below

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);
}
Mr Pablo
  • 4,109
  • 8
  • 51
  • 104
  • can you show your some code snippet? – JK Patel Jan 04 '13 at 13:31
  • Try commenting out the `usernameInput.restrict` line and the `passwordInput.restrict` line and see if the problem persists. I think it might have something to do with the regex, I had a problem similar to this in the past and found it to be caused by the regex I was using. – Jonny Henly Jan 05 '13 at 03:13
  • I encountered the same thing. As @JonnyHenly points out, it seems to be a bug with restrict. Check out [this answer](http://stackoverflow.com/questions/14406833/stagetext-issues-with-autocorrect-and-restrict) for a workaround using a Change listener to validate input instead of restrict property. – Pixel Elephant Jan 20 '13 at 07:12

0 Answers0