5 Replies Latest reply on May 19, 2012 1:26 PM by ImperialUser

    how to modify text in a textbox?

    ImperialUser Level 1

      Whenever i do _root.textboxname.text = "new text"; it turns the textbox blank.  What am I doing wrong?

        • 1. Re: how to modify text in a textbox?
          prodigalmaster Level 2

          How do you have it set up?


          Remember the text will only go the length of the textbox, so if the box is 1 character long then it will only display: n (the first character).


          The textbox should be dynamic or input, with an instance name. E.g. textboxname

          • 2. Re: how to modify text in a textbox?
            ImperialUser Level 1

            I have it set up correctly, as far as I can tell.  Initial text is 4 letters "text" and even setting it to = "a" still makes it a blank text box.  The only thing I have gotten to work is creating a second textbox and telling it textbox1 = textbox2.  It working correctly up to the point of changing the text, its only when the text gets changed that it becomes blank.



            textbox info: dynamic textbox, instance name "tester_text", initial text "text", width 130, height 80

            _root.tester_text.text = "a";


            When that line of code get's called, the text box goes completely blank.



            I found the issue, sort of.  If the textbox doesn't have anything in it then it works just fine.  But if it has text already in it then the issue above occurs.  Had a hunch, tried it out, blank text box works fine.


            (second add)

            It would be nice to know what the issue is, there will be times I want to edit code where the text box starts out with something in it.  Of course I could keep it blank and give it text at the start of the program if I have to...

            • 3. Re: how to modify text in a textbox?
              Ned Murphy Adobe Community Professional & MVP

              Make sure the textfield is not set up as multiline (if it is not supposed to be)

              • 4. Re: how to modify text in a textbox?
                ImperialUser Level 1

                It's not set to multi-line.  The issue has something to do with the text box already having text in it, or at least that's a symptom of what's going on.


                I tried blanking out the text box and then editing it but same thing.


                And now for some reason it's working fine.  I created a second text box, second text box.text = first text box.text, and now it's working fine without any issues.  Could it have been an issue with cs5?

                • 5. Re: how to modify text in a textbox?
                  ImperialUser Level 1

                  And now it's not working right again...am I doing something wrong?


                  I'm working with a longer string, and it only displays part of the string.


                  textbox.text = "hit" displays nothing

                  = "miss" displays "ss"

                  = "hitting" displays "ng"

                  = "hittingerry" displays "ngerr"


                  Is there something I have set wrong?



                  Found the issue.  Anti-Alias for the text box was set to bitmap.