2011-12-14 151 views
0

我一直在試用Flex 4.6中的Callout控件以用於移動應用程序而不是組合。該場景是,您有一個TextInput,提示用戶「選擇...」,當您觸摸它(iPad)時,它將獲得焦點並填充標註以允許您從列表中進行選擇。當編輯被禁用時,Flex TextInput不會觸發FocusIn事件

在Mac上運行時可以正常工作,但是當我部署到iPad時,如果TextInput控件已打開編輯,focusIn事件似乎只會觸發。由於彈出軟鍵盤,這個選項失敗了,而且當我真的只希望從列表中選擇控件時,控件是可編輯的。

TextInput控件的代碼是;

<s:TextInput id="txtLocation" x="171" y="149" 
      enabled="false" editable="false" 
      height="38" fontSize="16" 
      prompt="Select ..." 
      focusEnabled="true" 
      focusIn="depotCallout.open(this.txtLocation,true)"/> 

此代碼也是由Holly Schinsky在示例應用程序中演示如何使用標註。任何想法,將不勝感激。

回答

1

好吧,我有點自以爲是,不是一個專業的編碼員,但我找到了答案。

 <?xml version="1.0" encoding="utf-8"?> 
    <!-- mobile_keyboard/views/UseNextLikeTab.mxml --> 
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
      xmlns:s="library://ns.adobe.com/flex/spark" title="Change Focus"> 
     <fx:Declarations> 
      <!-- Place non-visual elements (e.g., services, value objects) here --> 
     </fx:Declarations> 

     <s:layout> 
      <s:VerticalLayout paddingTop="10" paddingLeft="10" paddingRight="10"/> 
     </s:layout> 

     <fx:Script> 
      <![CDATA[ 
       private function changeField(ti:TextInput):void { 
        // Before changing focus to a new control, set the stage's focus to null: 
        stage.focus = null; 

        // Set focus on the TextInput that was passed in: 
        ti.setFocus(); 
       } 
      ]]> 
     </fx:Script> 

     <s:HGroup> 
      <s:Label text="1:" paddingTop="15"/> 
      <s:TextInput id="ti1" prompt="First Name" 
         width="80%" 
         returnKeyLabel="next" 
         enter="changeField(ti2)"/>  
     </s:HGroup> 
     <s:HGroup> 
      <s:Label text="2:" paddingTop="15"/> 
      <s:TextInput id="ti2" prompt="Middle Initial" 
         width="80%" 
         returnKeyLabel="next" 
         enter="changeField(ti3)"/> 
     </s:HGroup> 
     <s:HGroup> 
      <s:Label text="3:" paddingTop="15"/> 
      <s:TextInput id="ti3" prompt="Last Name" 
         width="80%" 
         returnKeyLabel="next" 
         enter="changeField(ti1)"/> 
     </s:HGroup> 

    </s:View> 

我發現這個代碼頁上:Adobe fex 4.6