Skip to main content
Inspiring
November 5, 2014
Question

StageText ReturnKeyLabel.DONE, KeyboardEvent not dispatched on Nexus 5

  • November 5, 2014
  • 2 replies
  • 880 views

Hello,

On Android nexus 5, when ReturnKeyLabel.DONE in a StageText, KeyboardEvent is not dispatched

public function Main() {

  stage.scaleMode = StageScaleMode.NO_SCALE;

  stage.align = StageAlign.TOP_LEFT;

  addEventListener(Event.ADDED_TO_STAGE, init);

}

private function init(event:Event):void {

  var decoration:Sprite = new Sprite();

  decoration.graphics.lineStyle(4, 0x000000, 1);

  decoration.graphics.beginFill(0xFFFFFF, 1);

  decoration.graphics.drawRect(6, 44, stage.stageWidth-12, 70);

  this.addChild(decoration);

  var stageText:StageText = new StageText();

  stageText.returnKeyLabel = ReturnKeyLabel.DONE;

  stageText.fontSize = 40;

  stageText.stage = this.stage;

  stageText.viewPort = new Rectangle(10, 50, stage.stageWidth-20, 70);

  stageText.addEventListener(KeyboardEvent.KEY_DOWN, keyDownEventHandler);

}

private function keyDownEventHandler(evt:KeyboardEvent):void {

  if(evt.keyCode == Keyboard.ENTER)  evt.target.text="Enter key";

}

KeyboardEvent is dispatched if

stageText.returnKeyLabel = ReturnKeyLabel.GO;

Thanks

This topic has been closed for replies.

2 replies

Participant
August 24, 2016

Almost 2 years, and still buggy...

chris.campbell
Community Manager
Community Manager
August 24, 2016

Just took a look at the bug report, the last comment in particular says:

Shweta Bansal

9:12:41 PM GMT+00:00 Jan 19, 2015

This is AsDesigned as the KEY_DOWN event is not dispatched for all keys and varies by platform.
Refer the documentation below:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/StageText.html

Thanks.

Do you believe that this is a flawed design?  Could you explain why and provide the team with some feedback on how this should be implemented (keeping in mind that we need a solution that will work on all platforms).

I'll try and get some examples of keys/platforms that wouldn't generate a KeyDOWN or KeyUP event.

chris.campbell
Community Manager
Community Manager
November 5, 2014

Could you please open a new bug report on this over at bugbase.adobe.com?  When adding the bug, please include your sample code or an application so we can quickly test this out internally.

Once added, please post back with the URL so that others affected can add their comments and votes and I'll follow up internally.

Thanks,

Chris

pol2095Author
Inspiring
November 5, 2014
chris.campbell
Community Manager
Community Manager
November 7, 2014

Thank you!