# Play until a specific frame and stop

**URL:** <https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741>\
**Category:** Uncategorized\
**Created:** [August 18, 2002, 12:39pm UTC](https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741 "2002-08-18T12:39:19Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![vip3r](https://avatars.discourse-cdn.com/v4/letter/v/c2a13f/32.png) [@vip3r](https://forum.kirupa.com/u/vip3r)\
**Post date:** [August 18, 2002, 12:39pm UTC](https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741/1 "2002-08-18T12:39:19Z")

</div>

how would i do this using actionscript?  
i was kind of thinking like this:

onClipEvent(enterframe){  
if(thecurrentframe=2){  
stop();  
}  
}

but im not completely sure. what variable would the currentframe part be in??

---

<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:** [August 18, 2002, 4:06pm UTC](https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741/2 "2002-08-18T16:06:16Z")

</div>

Right click on the frame you want the movie to stop on, hit actions and just use stop()

---

<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:** [August 18, 2002, 4:10pm UTC](https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741/3 "2002-08-18T16:10:47Z")

</div>

well, the frame i want it to stop at will change depending on what the user clicks on… so i think i would have to use actionscript, right? since the conditional statement is actionscript, u would have to use actionscript to test the variable…

---

<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:** [August 18, 2002, 4:17pm UTC](https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741/4 "2002-08-18T16:17:00Z")

</div>

Well what about a gotoAndStop(frameNumber) action?

What are you trying to do, knowing that might help with the solution.

---

<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:** [August 18, 2002, 4:46pm UTC](https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741/5 "2002-08-18T16:46:30Z")

</div>

does go to and stop play through the until the stop number? i thought it just jumped to the specified frame…

when a user clicks a button,i want the animation to play and then stop at a specified frame…

i think the script i noted above will work once i figure out how to tell the frame is currnetly on…

---

<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:** [August 18, 2002, 5:00pm UTC](https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741/6 "2002-08-18T17:00:27Z")

</div>

What you need to do is create a movieclip that has the animation that you want in it and then place a stop action on the first frame of that movieclip. Then label the frame that you want the animation to start at and put a stop action and the frame that you want the animation to stop at. You can then just attach some code to your button like:

on(release){  
\_root.animation.gotoAndPlay(“start”);  
}  
that should solve your problem and remember to give an instance name, this should through your animation rather then just going to a specific frame. You could also just make the animation on the main timeline and do the same procedure, it will work the same way.

Hope this helps

Kyle:)

---

<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:** [August 18, 2002, 7:24pm UTC](https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741/7 "2002-08-18T19:24:25Z")

</div>

thanx a lot, but when the user clicks another button, i want it to stop at another place. u can download my flash file thingy at [http://www.vip3r.com/temp/navigator.fla](http://www.vip3r.com/temp/navigator.fla)  
and then u can c what im talking about…  
up there where the selctor layer is, i want the selector object to move to cover the button clicked on…  
thanx 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:** [August 18, 2002, 8:04pm UTC](https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741/8 "2002-08-18T20:04:56Z")

</div>

your fla is corrupted my machine wont’ open the file…

Kle

---

<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:** [August 18, 2002, 8:28pm UTC](https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741/9 "2002-08-18T20:28:34Z")

</div>

i’ll send u the file, wuts ur email?  
if u don’t feel like putting it on the forums, just email me:  
[snakedevil1@lycos.com](mailto:snakedevil1@lycos.com)  
and i’ll reply with the file  
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:** [August 19, 2002, 1:56am UTC](https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741/10 "2002-08-19T01:56:05Z")

</div>

viper,

your original code is only a few characters away from working:

```auto

onClipEvent(enterframe){
   if(_currentframe==2){
      stop();
   }
}

```

---

<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:** [August 20, 2002, 1:35am UTC](https://forum.kirupa.com/t/play-until-a-specific-frame-and-stop/4741/11 "2002-08-20T01:35:52Z")

</div>

wow, thats pretty close 🙂  
thanx for helping 🙂
