# \[FMX\]Shorten movieclip

**URL:** <https://forum.kirupa.com/t/fmx-shorten-movieclip/45274>\
**Category:** flash\
**Created:** [March 12, 2004, 5:25pm UTC](https://forum.kirupa.com/t/fmx-shorten-movieclip/45274 "2004-03-12T17:25:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_Roboto](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@Mr\_Roboto](https://forum.kirupa.com/u/Mr_Roboto)\
**Post date:** [March 12, 2004, 5:25pm UTC](https://forum.kirupa.com/t/fmx-shorten-movieclip/45274/1 "2004-03-12T17:25:36Z")

</div>

I have a movie clip that is about 80 frames. It just cycles through 4 pictures at 20 frames per pic. I want to use actionscript so I can cut down the number of frames. I thought I could use a while loop to do this. Here is what my code looked like:

stop();  
x = 0;  
while (x\<1001) {  
x++;  
}

if (x == 1000) {  
gotoAndStop(2);  
}

Would something like this work?

---

<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:** [March 12, 2004, 11:05pm UTC](https://forum.kirupa.com/t/fmx-shorten-movieclip/45274/2 "2004-03-12T23:05:35Z")

</div>

Hmm, I am not quite sure what that means. I attached that code to my movie clip and it just stayed at the first image. Do I need to define “i” as something? I tried setting it to 0 and 20 not knowing what that would do.

---

<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:** [March 13, 2004, 6:54am UTC](https://forum.kirupa.com/t/fmx-shorten-movieclip/45274/3 "2004-03-13T06:54:12Z")

</div>

search the fourm for setInterval or look it up in help. You can use that to pause the movie for a certain amount of time.

---

<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:** [March 15, 2004, 4:42am UTC](https://forum.kirupa.com/t/fmx-shorten-movieclip/45274/4 "2004-03-15T04:42:26Z")

</div>

Thanks, it works now, but it only goes through once. Can I make it so it loops an infinite amount of times?

---

<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:** [March 15, 2004, 4:04pm UTC](https://forum.kirupa.com/t/fmx-shorten-movieclip/45274/5 "2004-03-15T16:04:31Z")

</div>

change [AS]i++;[/AS]to[AS]if (i == **numberofpictures** \*20+20) {  
i = 0;  
} else {  
i++;  
}  
[/AS]change numberofpictures to the number of pictures you have

---

<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:** [March 15, 2004, 5:15pm UTC](https://forum.kirupa.com/t/fmx-shorten-movieclip/45274/6 "2004-03-15T17:15:29Z")

</div>

Thanks a lot, it works now. Sorry to be a nuisance, but I have one last question, could you possibly explain what that code does. I now what the onclip commands do, but I don’t understand what is going inside of the enterFrame section.
