0 Replies Latest reply on Jul 30, 2009 2:07 AM by michaeleekk

    Auto Focus on TextInput UI (Flex 4 Spark problem)

    michaeleekk

      Hi All

       

      This's my first post here.

       

      Recently, I"m trying the new Flash Builder, making a TextInput with auto focus on start up and after press enter.

       

      Here's the code:

      <s:TextInput id="symbolText" enter="quotesButton_clickHandler()" restrict="0-9A-Za-z,.\^ "/>
      <s:Button label="Quotes" id="quotesButton" click="quotesButton_clickHandler(event)"/>
      

       

      In the quotesButton_clickHandler() function, I wrote something like this:

       

      protected function quotesButton_clickHandler(event:MouseEvent=null):void
      {
           //Some more here :P
      
           symbolText.setFocus();
           symbolText.setSelection(0,0);
      }
      

       

      Although this can make the flashing input cursor went into the TextInput component, I can't input after press enter.

       

      After I changed the TextInput back to Halo, like this:

      <mx:TextInput id="symbolText" enter="quotesButton_clickHandler()" restrict="0-9A-Za-z,.\^ "/>
      <s:Button label="Quotes" id="quotesButton" click="quotesButton_clickHandler(event)"/>
      

      It works like I expected!

       

      Very weird.