2013-05-05 3 views
1

Flash Builder 4.6을 사용하고 있습니다. flex 프로젝트에서 intitialize가 완료된 후 textInput에 setFocus를 설정하려고합니다. 나는 코드 myTextInput.setFocus()를 사용하고있다; 이 커서가 잘 깜빡이고 있지만 작동하지 않습니다. TextInput에 초점을 맞추기 위해 TextInput을 강조 표시합니다. 내 모든 코드는 여기에 있습니다 :TextInput setFocus가 플래시 빌더에서 작동하지 않습니다. 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

+0

브라우저 특정 문제 일 수 있습니까? IE를 사용하고 있습니까? –

+0

잘 작동합니다 ... –

답변

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'); 
    } 
} 
관련 문제