5 Replies Latest reply on Dec 19, 2011 3:20 PM by frank_aq

    Flex 4.6 mobile TextInput and Enter listener

    frank_aq

      Hi everyone,

       

      I'm currently extending the new flex 4.6 TextInput to create a custom input control. I'm having some issues with the soft keyboard resizing when I set the stage focus to null. I have this set in my app.mxml resizeForSoftKeyboard="true".

       

      Since I can't seem to find a enter listener in the new mobile text skin I'm using the following code to listen for the Enter key:

       

      public function CustomTextInput(){
                  
                  super();
                  this.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyUp, false, 0, true);
            
                  
              }
              
              private function handleKeyUp(e:KeyboardEvent):void{
                  if(e.keyCode == 13){
                      stage.focus = null
                  }
              }
      

       

      The issue I'm having is when you hit return the keyboard does go away but the application doesn't resize. This leaves me with a white block the exact size of the keyboard. If you refocus on the text field, bring up a new keyboard and close it using the close keyboard key the app resizes correctly.

       

       

      Unrelated but another question. Is there any way to override the android back key so that when you have a soft keyboard open it closes it instead of doing a popView?