2013-05-05 67 views
1

我正在使用Flash Builder 4.6。並工作的柔性項目其中我想在intitialize完成後setFocus on textInput。我使用的代碼是myTextInput.setFocus(); 這是工作正常的光標閃爍,但不突出顯示TextInput用於聚焦TextInput。我所有的代碼是在這裏:TextInput setFocus在Flash Builder中不起作用4.6

<?xml version="1.0" encoding="utf-8"?> 
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
       xmlns:s="library://ns.adobe.com/flex/spark" 
       xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" initialize="init();"> 
    <fx:Script> 
     <![CDATA[ 
      private function init():void{ 
       myTextInput.setFocus(); 
      } 
     ]]> 
    </fx:Script> 
    <fx:Declarations> 
     <!-- Place non-visual elements (e.g., services, value objects) here --> 
    </fx:Declarations> 
    <s:Panel x="54" y="23" width="250" height="200"> 
     <s:TextInput x="98" y="42"/> 
     <s:TextInput id="myTextInput" x="98" y="12"/> 
    </s:Panel> 
</s:Application>    
+0

在這裏工作很好。頂部文本輸入周圍的藍色邊框。更改了項目的皮膚設置? – codingbuddha 2013-05-05 05:27:21

+0

可能是瀏覽器特定的問題?你使用IE嗎? – 2013-05-05 20:44:59

+0

其工作正常... – 2013-05-06 03:38:01

回答

0

指數模板:

function setFocus(){ 
    window.document.getElementById("APPNAME").focus(); 
    $('#myTextInput').focus(); 
    $('#myTextInput').focusEnables=true; 
} 
    </script> </div> 

應用:

private function init():void{ 
    if (ExternalInterface.available) { 
     ExternalInterface.call('setFocus'); 
    } 
} 
相關問題