# "cycling" to a number with AS

**URL:** https://forum.kirupa.com/t/cycling-to-a-number-with-as/20050
**Category:** flash
**Created:** [May 4, 2003, 5:03pm UTC](https://forum.kirupa.com/t/cycling-to-a-number-with-as/20050 "2003-05-04T17:03:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![xmattx](https://avatars.discourse-cdn.com/v4/letter/x/6de8d8/32.png) [@xmattx](https://forum.kirupa.com/u/xmattx)
#### Post date: [May 4, 2003, 5:03pm UTC](https://forum.kirupa.com/t/cycling-to-a-number-with-as/20050/1 "2003-05-04T17:03:08Z")

</div>

… ok, i want to creat a dynamic text field and be able to cycle from “1” to another number, w/e number i choose, basicaly like a preloader, but with me inputting the final number, hence the final number is not based on a percent, or math equation. Im sure this is actually very easy, i just cant see to figure it out.

thanks.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [May 5, 2003, 4:10am UTC](https://forum.kirupa.com/t/cycling-to-a-number-with-as/20050/2 "2003-05-05T04:10:27Z")

</div>

any information about the speed at which you want it to count up or anything??? going from say 1 to 20 may go so fast you’d never see it counting, so you may want to use the setinterval function to increment the text field a little slower…basically (if i get what youre asking) you want to set the text field in the first frame…

mytextfield.text = 1;

then loop through the next two frames, one with this code…

mytextfield.text++;

and the third that says go back to frame 2…be sure to have the textfield in a seperate layer that spans all the frames with the code…also this is more of an mx solution (instance names on textfields)…for flash 5, use the “var” property to increment a variable linked to the textfield…hope that helps…rob
