2012-03-19 17 views
0

私は私のウィジェットで、次のApplicationタグコードを持っている:入力フィールドがFlex/MXMLでcreationCompleteの入力用に入力テキストコントロールを準備する方法は?

<mx:TextInput id="Input_txi" left="10" right="90" bottom="10"/> 

次によって定義される

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
      xmlns:local="*" 
      width="100%" height="100%" minWidth="200" minHeight="200" layout="absolute" 
      creationComplete="init()" 
      defaultButton="{Send_btn}"> 

私はinit()メソッドの最後に次き:

  Input_txi.setFocus(); 
      Input_txi.selectRange(0,0); 

しかし、私はページがロードされた直後にテキストを入力することはできません。視覚的にはInput_txiに焦点が当てられていますが、キープリントは何もしません。私はそれにテキストを入力する前にInput_txiをクリックする必要があります。

私は最初からやり直すことができますか?

EDIT 1

例のように、またjQueryを使ってどちらも、働いていない:ブラウザがページをロードすると、正しいテキスト入力がSWF内のフォーカスを持っているかもしれ

<script type="text/javascript" src="swfobject.js"></script> 
    <script type="text/javascript" src="jquery-1.7.1.js"></script> 
    <script type="text/javascript"> 
     // For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. 
     var swfVersionStr = "${version_major}.${version_minor}.${version_revision}"; 
     // To use express install, set to playerProductInstall.swf, otherwise the empty string. 
     var xiSwfUrlStr = "${expressInstallSwf}"; 
     var flashvars = {}; 
     var params = {}; 
     params.quality = "high"; 
     params.bgcolor = "${bgcolor}"; 
     params.allowscriptaccess = "sameDomain"; 
     params.allowfullscreen = "true"; 
     var attributes = {}; 
     attributes.id = "${application}"; 
     attributes.name = "${application}"; 
     attributes.align = "middle"; 
     swfobject.embedSWF(
      "${swf}.swf", "flashContent", 
      "${width}", "${height}", 
      swfVersionStr, xiSwfUrlStr, 
      flashvars, params, attributes, function(){ 
       /* 
       var swf = $("#" + attributes.id); 
       swf.attr("tabindex", 0); 
       swf.focus(); 
       */ 

       var f = swfobject.getObjectById(attributes.id); 
       f.tabIndex = 0; 
       f.focus(); 
      }); 
     // JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. 
     swfobject.createCSS("#flashContent", "display:block;text-align:left;"); 

    </script> 
+0

'ExternalInterface'方法を働きました。 – Dims

答えて

関連する問題