# removeMovieClip()

**URL:** <https://forum.kirupa.com/t/removemovieclip/12212>\
**Category:** programming\
**Created:** [January 28, 2003, 3:39pm UTC](https://forum.kirupa.com/t/removemovieclip/12212 "2003-01-28T15:39:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Ducey](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@Michael\_Ducey](https://forum.kirupa.com/u/Michael_Ducey)\
**Post date:** [January 28, 2003, 3:39pm UTC](https://forum.kirupa.com/t/removemovieclip/12212/1 "2003-01-28T15:39:08Z")

</div>

1)I was able to load an external .swf file into  
a blank movie clip (A TARGET CLIP WHICH I CREATED using  
createEmptyMovieClip)  
2)Also by placing a button on the stage I was  
able to remove the movie clip

BUT I WOULD LIKE TO BE ABLE TO KEEP ALL MY CODE IN THE FIRST FRAME. I would  
like to Remove the Movie without putting the code on the button. But it  
didn’t work.

Here is the code on the button that Does work

on (release) {  
\_root[“middle\_mc”].removeMovieClip(); //middle\_mc is my  
target clip and  
main01.swf is the external swf file //replace with any swf  
you have in same  
directory  
}

This is the code on the first frame  
[UNDERNEATH THAT IS MY ATTEMPT TO REPRODUCE THE CODE ON THE BUTTON]  
I commented it out because I tried different ways to REPRODUCE WHAT HAD  
ALREADY WORKED USING THE BUTTON!

this.createEmptyMovieClip(“middle\_mc”, 1)  
this.middle\_mc.\_x=0;  
this.middle\_mc.\_y=0;  
this.middle\_mc.loadMovie(“main01.swf”); //use your own swf

// NOW FOR THE STUFF THAT DIDN’T WORK ON FRAME 1 - THERE ARE DIFFERENT VERSIONS OF MY ATTEMPTS UNDER EACH OTHER HERE  
mybutton.onRelease.removeMovieClip.\_root(middle\_mc);  
[//mybutton.onRelease.unloadMovie](https://mybutton.onRelease.unloadMovie).\_root(middle\_mc);  
[//mybutton.onRelease.unloadMovie](https://mybutton.onRelease.unloadMovie).\_root[“middle\_mc”, 1];  
[//mybutton.onRelease.MovieClip.onUnload](https://mybutton.onRelease.MovieClip.onUnload).\_root(“middle\_mc”);

Hopefully, the question is clear. I keep trying to be able to swap my code  
from button to frame. I’d like to be clear as to how to do the same thing in  
both ways.

I’d appreciate any help!  
Mike  
:sigh:

---

<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:** [January 28, 2003, 6:11pm UTC](https://forum.kirupa.com/t/removemovieclip/12212/2 "2003-01-28T18:11:54Z")

</div>

if you place your actionscript in a button or mc you use event handlers such as:

onClipEvent (load) {  
onClipEvent (enterFrame) {  
on (rollOver) {  
on (rollOut) {  
etc. etc.

to use the event handler from the timeline:

instanceName.onEnterFrame = function () {  
instanceName.onLoad = function () {  
instanceName.onRollOver = function () {  
instanceName.onRollOut = function () {

```auto

this.createEmptyMovieClip ("middle_mc", 1)
this.middle_mc._x=0
this.middle_mc._y=0
this.middle_mc.loadMovie ("main01.swf")
mybutton.onRelease = function () {
	unloadMovie (middle_mc)
}

```

---

<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:** [January 28, 2003, 6:41pm UTC](https://forum.kirupa.com/t/removemovieclip/12212/3 "2003-01-28T18:41:17Z")

</div>

Thank you very much!

I knew it had to be a very short code, and yet everything I tried just didn’t work.

Much Appreciated!

Mike

---

<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:** [January 28, 2003, 6:46pm UTC](https://forum.kirupa.com/t/removemovieclip/12212/4 "2003-01-28T18:46:44Z")

</div>

no problem dude 🙂

glad i could help :beam:

---

<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:** [January 30, 2003, 12:43am UTC](https://forum.kirupa.com/t/removemovieclip/12212/5 "2003-01-30T00:43:25Z")

</div>

I am in the same situation, but my format is slightly different than that. Whenever i click a button, i want an swf to open in a movie clip(done this) should someone click on another button, how would i remove this one, and load the other one??:stunned: My buttons are all in a jumble. Anyone know how to explain this? Any help would be really great. =)
