# Looping

**URL:** <https://forum.kirupa.com/t/looping/21929>\
**Category:** Uncategorized\
**Created:** [May 28, 2003, 3:42am UTC](https://forum.kirupa.com/t/looping/21929 "2003-05-28T03:42:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![naomi](https://avatars.discourse-cdn.com/v4/letter/n/ee59a6/32.png) [@naomi](https://forum.kirupa.com/u/naomi)\
**Post date:** [May 28, 2003, 3:42am UTC](https://forum.kirupa.com/t/looping/21929/1 "2003-05-28T03:42:03Z")

</div>

I have a movie clip which consists of four frames, with an onmousedown function applied to the movie so that on each click it goes to the next frame. How would I then apply a loop so that after reaching the final frame, the next click will take you back to frame 1 and so on??  
(sorry, I’m new at flash)

cheers  
naomi

---

<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 28, 2003, 3:59am UTC](https://forum.kirupa.com/t/looping/21929/2 "2003-05-28T03:59:50Z")

</div>

try this :):

```auto
mymovieclip.onMouseDown = function() {
(this._currentframe == this._totalframes) ? : this.gotoAndStop(1) : this.nextFrame()
}

```
