3 Replies Latest reply on May 31, 2006 10:02 AM by albee

    Copying text to new text box - can it be done?

    obabilon
      I'm trying to create a single elimination chart for a competition. The names of 32 participants are inputted with input text. How can I create an actionscript that if you click on a button next to their name (the winner) that their name will copy into another text box to the right.
        • 1. Re: Copying text to new text box - can it be done?
          albee Level 1
          Make sure each text field has an instance name. If so, you can code the button as follows:
          // for the sake of this example, we'll call the button my_btn, the input text field input_txt, and
          // the new text field new_txt; all three objects are in the same timeline
          my_btn.onRelease = function () {
          var inputName = input_txt.text;
          new_txt.text = inputName;
          };

          This should solve your problem...

          Good luck,

          Albee
          • 2. Re: Copying text to new text box - can it be done?
            obabilon Level 1
            That worked, Albee. Thank you. New question is how do I get the text in the movie to be blank. Now it's showing up as _level0.b1. I've named the instance names of the input text boxes as a1, a2 and b1. I've also used the same name for the Var:

            And one more question: is there a way to control the tabbing in the Flash movie so it's not hitting the buttons and just hitting the text boxes that are the input boxes?

            BTW - you're working with a beginner here but I'm a quick learner...and I'm thankful for your time.
            • 3. Re: Copying text to new text box - can it be done?
              albee Level 1
              1. OK, if I understand your question correctly, the answer is to assign an empty string to the text field:
              a1.text = "";
              // notice that the empty string is two quotation marks right next to each other, no space...

              2. For tabbing order, there are properties of textfields and movie clips called tabIndex and tabEnabled. Within a timeline, if you've assigned indexes starting with 1 and up to the corresponding textfields, they will tab in that order:
              a1.tabIndex = 1;
              a2.tabIndex = 2;
              b1.tabIndex = 3;

              If you don't want the tab key to focus on a clip or textfield, set it's boolean property, tabEnabled, to false:
              a1.tabEnabled = false;

              Hope this helps...

              Albee