4 Replies Latest reply on Jun 22, 2012 4:59 AM by sinious

    have text from button input scroll


      Working on a keyboard applicaition, and I've having trouble making the text scroll, or "trim" when it reaches the end.

      Now if I make a normal input text bar the text scrolls automatically when I trype into it.

        • 1. Re: have text from button input scroll
          sinious Most Valuable Participant

          Are you using TLF or Classic text?

          • 2. Re: have text from button input scroll
            tropicanaclock Level 1

            im using classic text, but i've played with tlf to see if it would work.

            any ideas

            • 4. Re: have text from button input scroll
              sinious Most Valuable Participant

              If you want it to continuously select the end of the input like a cursor would you just need to set the selection. Here's a full example of a timer firing off continuously adding in numbers into an input. You can just open a new document and paste this into a frame script:


              import flash.utils.Timer;

              import flash.events.TimerEvent;

              import flash.text.TextField;

              import flash.text.TextFieldAutoSize;

              import flash.text.TextFormat;

              import flash.text.TextFieldType;


              // create Input TextField, size, position and configure

              var myText:TextField = new TextField();


              myText.x = myText.y = 10;

              myText.width = stage.stageWidth - 20;

              myText.multiline = false;                                                  // keep it single line

              myText.wordWrap = false;                                                  // no wrapping out of view

              myText.autoSize = TextFieldAutoSize.NONE;           // no auto sizing

              myText.selectable = true;                                                  // so you can select the text to see it's all there

              myText.type = TextFieldType.INPUT;                              // input type

              myText.defaultTextFormat = new TextFormat("Arial",16,0x0);

              myText.text = "0";


              //  init variable for the number I'm adding as text

              var currentNumber:uint = 0;


              // create a timer to add text to the field, just adding numbers for ease

              var myTimer:Timer = new Timer(200, 200);

              myTimer.addEventListener(TimerEvent.TIMER, handleTimer, false, 0, true);



              // function to add the number to the textfield (simulate typing into it)

              function handleTimer(e:TimerEvent):void


                        currentNumber += 10;                                                            // add 10 before appending to the textfield

                        myText.appendText(", " + currentNumber);           // append to TextField




              Or easier to read here:




              The general idea is after each append I just set the selection to the last character index. As long as you use length it will always be the end of the input and if it's the same start and end index no text is actually selected.


              I've done a lot of on-screen keyboards at kiosks.