2013-05-05 68 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'); 
    } 
} 
相关问题