3 Replies Latest reply on May 8, 2007 10:29 PM by MurMeeKeer

    text field selection after mouse focus

      In a test file, I have two input text fields on the stage, one_txt and two_txt. I want the default text to become selected when the text field gains focus. I have the following code in frame 1:
      one_txt.border = two_txt.border = true;
      one_txt.maxChars = two_txt.maxChars = 3;
      one_txt.text = "360"; // Default values
      two_txt.text = "100";
      one_txt.onSetFocus = function() {
      trace("onSetFocus in one_txt");
      two_txt.onSetFocus = function() {
      trace("onSetFocus in two_txt");
      This works fine if you give focus with the Tab key. But if you focus the field by clicking in it, the correct focus trace message is shown, but the text isn't selected. I tried Selection.setSelection (0,3), but it didn't work. (It sets the selection in the OTHER text field apparently the oldFocus object.) Why does this happen and how can I get my current text field text selected when a user clicks in it?
      Thanks in advance for any enlightenment and help.