2 Replies Latest reply on Mar 28, 2011 10:11 PM by huangxinghui

    TextField problem


      use TextInput, when input too many words, the textField.scrollH will be change


      then set the text property, textField.scrollH will be revert to 0 ?


      but sometime it is not, the textField.scrollH will not change to 0, so the content can not see




      example code:



      override public function set text(value:String):void
          super.text = value;
          if (textField)
              trace("scrollH=" + textField.scrollH);


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" 
                  private function changeHandler():void
                      textInput.text = 'aa';
         <component:MyTextInput id="textInput" width="100" text="asdf"/>
         <mx:Button label="Change" click="changeHandler()"/>


      Thanks a lot.

        • 1. Re: TextField problem
          Flex harUI Adobe Employee

          Set horizontalScrollPosition = 0 when setting the text.

          1 person found this helpful
          • 2. Re: TextField problem
            huangxinghui Level 1

            Thanks for you reply.


            set horizontalScrollPosition=0 can solve the problem.


            but it is strange, so i change MyTextInput like this


            public class MyTextInput extends TextInput
                override protected function commitProperties():void
                    trace("begin scrollH=" + textField.scrollH);
                    trace("after scrollH=" + textField.scrollH);

            when input too many word, the textfield scrolled. Then set text="aa"


            the console trace:

            begin scrollH=96
            after scrollH=0

            seem textField set text will change the scrollH=0 by itself, but sometime it is not.


            the flash player version is WIN