4 Replies Latest reply on Jun 14, 2010 6:43 AM by JabbyPandaUA

    Difference between Spark TextInput and Halo TextInput in handling cursor caret

    JabbyPandaUA Level 3

      Hi all,


         When changing the inputted text inside "change" event Spark TextInput component sets the caret cursor position at the beginning of the text, while Halo TextInput component under the same condition sets the caret cursor position at the end of inputted text.


         Try to enter "01" text in both TextInput to see the difference.


         Is there an easy way to change default Spark TextInput behaviour to match the behaviour of its older Halo TextInput counterpart?



      Code sample:


      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
                  import spark.events.TextOperationEvent;            
                  protected function ti_changeHandler(event:TextOperationEvent):void {                
                      ti.text = Number(ti.text).toString();                
                  protected function ti2_changeHandler(event:Event):void {           
                      ti2.text = Number(ti2.text).toString();
              <s:VerticalLayout paddingTop="10" paddingLeft="10"/>
          <s:TextInput id="ti" change="ti_changeHandler(event)" restrict="0-9.">
          <mx:TextInput id="ti2" change="ti2_changeHandler(event)" restrict="0-9.">


      Run the interactive sample here: