2 Replies Latest reply on Aug 27, 2006 4:04 PM by kglad

    how to construct the name of an instance in actionscript

    SPGAnne Level 1
      Sorry for being such a dim bulb newbie, but I know there has to be a way to do this, but I can't seem to get it right. I have a bunch of text items I have put in a movie clip, each having a name like myText1_txt, myText2_txt etc. I want to create a function that sets each field to some value where I would call setValue(fieldNum:String,value:Number). Where fieldNum would be 1,2, 3 etc. In the function I tried the following, but it doesn't seem to work.

      var myText:TextField;
      myText._name= "myText" + fieldNum + "_txt";
      myText.text = value;

      Alas, myText1._txt, myText2._txt etc. remain undefined.

      What am I doing wrong?