1 Reply Latest reply on Sep 21, 2006 11:20 PM by scsherwood

    Display numbers in dynamic text box

      Basically what I want to do is display numbers in a text box. Specifically 0-12 and going up in increments of 1. I have an animation that goes from frame 5 to frame 60 and I want the numbers to coincide with that animation.

      So at frame 5 I want 0 to be displayed and at frame 60 have 12, and also have the in between numbers as well.

      Just not sure how to go about starting this.
        • 1. Re: Display numbers in dynamic text box
          A very simple way to do this is to create a layer and name it "Actions." Lock this layer. Select this layer and open the actions window. Assuming you have a textInput on stage with an instance name of "myText," type the following code:

          First you create an "onEnterFrame" function which fires on entering each frame.
          next you divide the current frame number by 5 using the modulo operator, which returns zero whenever the "_currentframe" is a multiple of 5. Test for this condition, when true increment count by one and place the result in your text box.

          This method keeps your code all in one place. You could have placed a specific assignment statement, for example myText.text = 5, in individual keyframes in the actionscript layer at each frame where you wanted the number to change, but doing so spreads your code out over multiple frames and tends to get forgotten and lost.