# On clip event question

**URL:** <https://forum.kirupa.com/t/on-clip-event-question/14834>\
**Category:** Uncategorized\
**Created:** [March 3, 2003, 2:17pm UTC](https://forum.kirupa.com/t/on-clip-event-question/14834 "2003-03-03T14:17:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![soulty](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/soulty/32/105_2.png) [@soulty](https://forum.kirupa.com/u/soulty)\
**Post date:** [March 3, 2003, 2:17pm UTC](https://forum.kirupa.com/t/on-clip-event-question/14834/1 "2003-03-03T14:17:59Z")

</div>

Hey all.

Ive got a movie clip with some animation in it, what i would like to happen is that when the timeline reaches the end frame , i would like to play the 2nd frame of the MC or go to the frame label “bottom”

iam using

```auto

onClipEvent (enterFrame) {
    _root.sound.gotoAndPlay("bottom");
}

```

check ou the fla to see what i mean.  
thanx

---

<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 3, 2003, 2:43pm UTC](https://forum.kirupa.com/t/on-clip-event-question/14834/2 "2003-03-03T14:43:55Z")

</div>

hey **soulty** 🙂

the variable **ok** is to prevent the mc from executing the gotoAndPlay() action over and over once the final frame is reached

```auto
onClipEvent (enterFrame) {
	if (_level0._currentframe == _level0._totalframes && !ok) {
		this.gotoAndPlay("bottom");
		ok = true;
	}
}

```

---

<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 3, 2003, 11:05pm UTC](https://forum.kirupa.com/t/on-clip-event-question/14834/3 "2003-03-03T23:05:01Z")

</div>

works great, thanx kax. 🙂

Though i dont understand why it wouldnt of worked before, i made another keyframe at the end of the animation and put the code on that so it will only execute that code when it reaches that point? and applied some stop actions to the appropriate places inside the mc, what was it doing wrong?

thanx again  
Soulty 😏

---

<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 3, 2003, 11:11pm UTC](https://forum.kirupa.com/t/on-clip-event-question/14834/4 "2003-03-03T23:11:29Z")

</div>

no problem soulty =)

and … the problem?

the problem was that the mc executed the gotoAndPlay() action over and over again?

---

<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 3, 2003, 11:15pm UTC](https://forum.kirupa.com/t/on-clip-event-question/14834/5 "2003-03-03T23:15:22Z")

</div>

oh ok  
so it would be going to the label , going to the label without even playing the bottom label tween.  
makes complete sence 🙂  
thanx dude 😏

---

<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 3, 2003, 11:23pm UTC](https://forum.kirupa.com/t/on-clip-event-question/14834/6 "2003-03-03T23:23:48Z")

</div>

lol 😛

anytime 😉
