# Play once and stop loaded movie

**URL:** <https://forum.kirupa.com/t/play-once-and-stop-loaded-movie/9713>\
**Category:** flash\
**Created:** [December 17, 2002, 5:09am UTC](https://forum.kirupa.com/t/play-once-and-stop-loaded-movie/9713 "2002-12-17T05:09:43Z")\
**Posts on this page:** 7\
**Page:** 2

<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:** [December 17, 2002, 7:46pm UTC](https://forum.kirupa.com/t/play-once-and-stop-loaded-movie/9713/21 "2002-12-17T19:46:27Z")

</div>

Method 1) Create an empty movie clip symbol on the stage. Right click it and open the actions panel… Apply these actions…

```auto
onClipEvent (enterFrame) {
	if (_root.containerMC._currentframe == _root.containerMC._totalframes) {
		_root.containerMC.stop();
	}
}

```

Method 2) (Flash MX only)… Apply these actions to the frame your movie loads on.

```auto
_root.createEmptyMovieClip("checkFrame", 1);
_root.checkFrame.onEnterFrame = function() {
	if (_root.containerMC._currentframe == _root.containerMC._totalframes) {
		_root.containerMC.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:** [December 17, 2002, 8:29pm UTC](https://forum.kirupa.com/t/play-once-and-stop-loaded-movie/9713/22 "2002-12-17T20:29:10Z")

</div>

thanks I will give it a try.

2 Questions to clarify:

In method 1) containerMC is the "emptyMC symbol I ahve already created to which the exteral swf’s are loaded…

In method 2) Checkframe is the empty clip and containerMC is the external file which is loaded.

Thank you for providing so much help:)

---

<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:** [December 17, 2002, 8:31pm UTC](https://forum.kirupa.com/t/play-once-and-stop-loaded-movie/9713/23 "2002-12-17T20:31:38Z")

</div>

In Method One, the empty movie clip is actually a seperate movie clip than the one you load on.

But now that I think if it, I am not sure if it will work if you apply the code to the clip on the stage you are loading too… Interesting… I never thought about it. It is worth a try 🙂

In Method Two, “checkFrame” is the instance name of the empty movie clip dynamically created.

Then \_root.checkFrame.onEnterFrame = function() creates an event handler for the checkFrame movie clip. In this case, the event is the onEnterFrame.

---

<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:** [December 17, 2002, 8:40pm UTC](https://forum.kirupa.com/t/play-once-and-stop-loaded-movie/9713/24 "2002-12-17T20:40:44Z")

</div>

I would loadMovie to "checkFrame’ correct:)

---

<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:** [December 17, 2002, 8:44pm UTC](https://forum.kirupa.com/t/play-once-and-stop-loaded-movie/9713/25 "2002-12-17T20:44:56Z")

</div>

Yeah, but if the if statement doesn’t work, try loading the movie the same way you are now.

---

<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:** [December 17, 2002, 8:48pm UTC](https://forum.kirupa.com/t/play-once-and-stop-loaded-movie/9713/26 "2002-12-17T20:48:33Z")

</div>

I will.  
Be back later with an update  
Thanks 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:** [December 17, 2002, 8:49pm UTC](https://forum.kirupa.com/t/play-once-and-stop-loaded-movie/9713/27 "2002-12-17T20:49:19Z")

</div>

No problem, I hope it works. If not, then try just putting the if statement on the frame isntead of in an onEnterFrame.

[Previous page](https://forum.kirupa.com/t/play-once-and-stop-loaded-movie/9713.md?page=1)
