3 Replies Latest reply on Oct 18, 2006 6:00 PM by kglad

    Changing text inside a button

    jmarchan
      I made a button with a dynamic text field inside it and i'm trying to make the text change at runtime, someting like:

      for (i=0; i< myCount; i++) {
      duplicateMovieClip(item, "myButton"+i, this.getNextHighestDepth());
      this["myButton"+i].myDynamicText.text = Description ;
      }
      But it doesn't work... can anybody tell me what am doing wrong?
        • 1. Re: Changing text inside a button
          kglad Adobe Community Professional & MVP
          is item defined? if so, (and it's the instance name of a movieclip) you would only expect to see the last duplicate because they are all stacked on one another. to remedy, give them different _x and/or _y properties.
          • 2. Re: Changing text inside a button
            jmarchan Level 1
            I omitted part of the code but here it is exactly what i'm doing. What I find odd is that I can see the buttons lined up, so i can access the _y property just fine. inside the button there's a dynamic text field named myDynamicText but i can't change it. any suggestions?

            for (i=0; i< myCount; i++) {
            duplicateMovieClip(item, "myButton"+i, this.getNextHighestDepth());
            this["myButton"+i]._y = Y;
            this["myButton"+i].myDynamicText.text = Description ;
            Y += 20;
            }
            • 3. Re: Changing text inside a button
              kglad Adobe Community Professional & MVP
              if your button is a true (non-movieclip) button, then flash won't use the instance name of a textfield that you place on that button's timeline. flash assigns the textfield an instance name (something like instance43).

              to remedy, use a movieclip button. or use the trace() function to find the textfield's name assigned by flash and use that.