2011-12-15 87 views
6

我在彈性4.6和空氣3.1中的軟鍵盤行爲存在一些問題我有一個頂部帶有搜索欄的列表,其中包含一些與flex 4.6和air 3.1中的軟鍵盤行爲有關的問題。當用戶選擇TextInput組件時,軟鍵盤彈出應有的樣子。 現在,當用戶完成輸入他的文字,並按下返回(或做/搜索/ ...)鍵我想softkeyboard消失。Flex 4.6隱藏/關閉軟鍵盤

我試過到目前爲止:

  • 我已經設置returnKeyLabel屬性設置爲「完成」和按鈕顯示 妥當。但是,僅駁回鍵盤Android設備, IOS鍵盤只是熬夜。

  • 然後我通過不設置returnKeyLabel和手動 捕捉回車鍵和焦點設置到另一個元素 不需要softkeyboard但也不能工作試過。

  • 我也派遣我自己的「僞造」點擊事件時,按下回車鍵,但是這也沒有工作嘗試。

作爲搜索這個問題的一部分,我發現這個Dismiss SoftKeyboard in Flex Mobile,但那也沒有工作。或者至少不在flex 4.6

現在有沒有人知道一個好方法隱藏softkeyboard或使returnKeyLabel「完成」在IOS上工作,將與flex 4.6/air 3.1一起工作?

回答

9

你有沒有嘗試過這樣的事情?

<s:TextInput prompt="First Name" returnKeyLabel="done" enter="handlerFunction()"/> 
private function handlerFunction():void{ 
    stage.focus = null 
} 
+0

這工作,THX;) – Beele 2011-12-20 07:49:07

3

對於Flex移動Android應用我都模仿的背景攻如下去除softkeyboard的直觀的IOS方式:

import spark.components.supportClasses.* 
     protected function application1_clickHandler(event:MouseEvent):void 
     { 

      if(event.target is StyleableTextField || event.target is StyleableStageText){ 
       // ignore because came from a textInput 
      }else{ 
       stage.focus = null 
       // to remove the softkeyboard 
      } 
     }