1 Reply Latest reply on Dec 15, 2006 5:22 PM by kglad


      For selecting all the text in a dynamic text field. I had problems with the code below losing focus after the selection. I was chasing my tail like a mad dog trying to figure it out. I embedded the text field in a movie clip, published it as HTML, traced it, everything, till our ARTIST said, "Why don't you try an onRelease." Now it works like a charm. Some days I love Flash & others well....

      selectText_btn.onPress = function()
      Selection.setSelection(0, my_txt.text.length);

      Just thought the community needed a PSA. If anybody can enlighten me on why this works the way it does I would love to get an explanation.
        • 1. Re: setSelected()
          kglad Adobe Community Professional & MVP
          when you press your button your onPress handler will execute, your text gets focus and then an onRelease (or some other mouse event) will set focus back to your button.

          when you use an onRelease handler your button gets focus, your code executes, your text gets focus and you're a happy weenie.