5 Replies Latest reply on Jul 9, 2008 2:19 PM by kglad

    Dynamically created Text field inside of empty Movieclip

    AunStudio

      Hi there.

      My goal is to have a button that, when clicked, an empty movieclip is created and a text field is attached to it.

      I could write it easily if the newly created instance names where hard coded, the problem comes with the syntax to generate them dynamically.

      Here's the code i have so far:

      ActionScript Code:

      button.onRelease = function() {
      createText();
      }
      var count:Number = 1;
      createText = function () {
      _root.createEmptyMovieClip("placeholder"+count,this.getNextHighestDepth()); this["placeholder"+count].createTextField("my_txt"+count, this.getNextHighestDepth(), 100, 100, 100, 100); count++;
      }


      After that's done i still need to assign a text value to the text field, which i have no clue on how to do it...

      In other words I want to accomplish something like:

      placeholder[count].my_txt[count].text = "my text";


      I hope it's not confusing... Any help would be greatly appreciated.

      Thanks in advance!