3 Replies Latest reply on Apr 21, 2009 2:00 AM by nagarjunaakkineni

    Focus on TextInput with cursor

      Hi All,

                  I have a problem with focus here.How to set the focus with cursor on TextInput when the application loads.

      Thanks & Regards,


        • 1. Re: Focus on TextInput with cursor
          flex_heman Level 1



          u can use setfocus method

          • 2. Re: Focus on TextInput with cursor
            Gregory Lafrance Level 6

            It is actually setFocus(), not setfocus(), and it does not put the insertion point in the TextInput, which I think the original poster wanted, though I don't have a solution for that.


            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="textinput.setFocus();">
              <mx:TextInput id="textinput"/>
              <mx:TextArea id="textarea"/>

            • 3. Re: Focus on TextInput with cursor
              Level 1

              Hey Greg,

                              I need focus plus cursor on TextInput when the application loads.I know how to focus but i don't know how to place the cursor on the TextInput.I have a code for this problem it is working in windows systems but it is not working in Ubuntu(i mean Linux) systems.Why problem i don't know.


              Here am sending the code also,


              <?xml version="1.0" encoding="utf-8"?>
              <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="init();">
                  <mx:TextInput id="txt"/>
                          private function init():void {
                                if (ExternalInterface.available){
                                  ExternalInterface.call("s = function() { document.getElementById('"+this.id+"').focus(); }");




              Thanks & Regards,