# Play entire movie 2 times then stop

**URL:** https://forum.kirupa.com/t/play-entire-movie-2-times-then-stop/5231
**Category:** Uncategorized
**Created:** [September 5, 2002, 5:31am UTC](https://forum.kirupa.com/t/play-entire-movie-2-times-then-stop/5231 "2002-09-05T05:31:21Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![linque](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/linque/32/50_2.png) [@linque](https://forum.kirupa.com/u/linque)
#### Post date: [September 5, 2002, 5:31am UTC](https://forum.kirupa.com/t/play-entire-movie-2-times-then-stop/5231/1 "2002-09-05T05:31:21Z")

</div>

last week I learned to play a movieclip a specified number of times then stop.

Now, I need to stop an entire .fla (or, it may become a scene, but for now it’s the only content) after it loops TWO times only.

The .fla has one frame containing graphics and text on separate layers and 4 movieclips on different layers. The movieclips have no actionscript in them right now. They are essentially tweens over staggered times.

In fact, right now there’s no actionscript anywhere in this particular .fla.

How can I play it two times then stop. Also, I need to be able to accomodate further stuff after this… that is, the movie is not yet been completed…it was just a start, but it’s only this part that _is_ completed I need to loop twice.

Please could you let me where the code would go too?

thank you

linda

---

<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: [September 5, 2002, 5:37am UTC](https://forum.kirupa.com/t/play-entire-movie-2-times-then-stop/5231/2 "2002-09-05T05:37:35Z")

</div>

set a variable in the first frame  
myVar +=1;

Then do an if at the end of the animation

if(myVar = 2){  
stop();  
}else{  
gotoAndPlay(1);  
}

Ok that should 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: [September 5, 2002, 6:04am UTC](https://forum.kirupa.com/t/play-entire-movie-2-times-then-stop/5231/3 "2002-09-05T06:04:56Z")

</div>

I added an actionscript layer, put in your code for the first frame, added a new keyframe in frame2 and put the rest of the code there. I also added blank frames to each of the other layers so all is 2 frames long. it’s not working yet… I used your script verbatim. Is there something I was to attach the variable to? somewhere in the property inspector?

sorry…newbie here…

---

<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: [September 5, 2002, 6:15am UTC](https://forum.kirupa.com/t/play-entire-movie-2-times-then-stop/5231/4 "2002-09-05T06:15:18Z")

</div>

instead of gotoAndPlay try gotoAndStop(frame#)

This assures it will STOP at that frame, where, even if a stop() action is applied to the frame gotoAndPlay will surpass it and still play the clip.

---

<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: [September 5, 2002, 6:15am UTC](https://forum.kirupa.com/t/play-entire-movie-2-times-then-stop/5231/5 "2002-09-05T06:15:22Z")

</div>

verbatim? 🙂

---

<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: [September 5, 2002, 6:16am UTC](https://forum.kirupa.com/t/play-entire-movie-2-times-then-stop/5231/6 "2002-09-05T06:16:56Z")

</div>

I was wondering the same thing.

---

<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: [September 5, 2002, 6:17am UTC](https://forum.kirupa.com/t/play-entire-movie-2-times-then-stop/5231/7 "2002-09-05T06:17:39Z")

</div>

yeah…ok

---

<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: [September 5, 2002, 7:05am UTC](https://forum.kirupa.com/t/play-entire-movie-2-times-then-stop/5231/8 "2002-09-05T07:05:26Z")

</div>

I used code to count up within the tweened movieclips.  
It wouldn’t work on the main timeline, although I suppose I’ve erred somewhere. thanks anyway.

p.s. verbatim… yup…

check it out
