# Button loadMovie question

**URL:** <https://forum.kirupa.com/t/button-loadmovie-question/27838>\
**Category:** flash\
**Created:** [August 7, 2003, 4:35am UTC](https://forum.kirupa.com/t/button-loadmovie-question/27838 "2003-08-07T04:35:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![RussianBeer](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/russianbeer/32/152_2.png) [@RussianBeer](https://forum.kirupa.com/u/RussianBeer)\
**Post date:** [August 7, 2003, 4:35am UTC](https://forum.kirupa.com/t/button-loadmovie-question/27838/1 "2003-08-07T04:35:11Z")

</div>

Okay, I have a Button outside the MC,

When You click it… it loads something in the the MC. Can I have the button disapear once I click it and it loads the new movie?

So far the code is:

> on (release){  
> entrance.loadMovie (“bio.swf”)  
> }

Or if there is no way to do this, can I have the buttons IN the MC, and when clicked it loads the new MC in the same ‘entrance’ mc but from inside it… ?

---

<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 7, 2003, 4:40am UTC](https://forum.kirupa.com/t/button-loadmovie-question/27838/2 "2003-08-07T04:40:25Z")

</div>

yes. just put a delete in front of it

[AS]  
delete this.myButtonName;  
[/AS]

Should do it. Replace this with the location of you button on the timeline. \_root etc

---

<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 7, 2003, 4:53am UTC](https://forum.kirupa.com/t/button-loadmovie-question/27838/3 "2003-08-07T04:53:37Z")

</div>

use [AS]this.\_visible = false[/AS]

If it is a movie clip symbol acting as a button you can swap it to a removable depth then use removeMovieClip() on it to remove it for good, but as far as I know, button symbols can’t be removed via AS, on hidden.

grandsp5: delete is used for deleting variables and dynamic event handlers, etc, etc. You can’t use it to delete a clip from the stage.

If I am wrong about any of this, sorry, the cold medication has kicked in :hangover:

---

<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 7, 2003, 6:10am UTC](https://forum.kirupa.com/t/button-loadmovie-question/27838/4 "2003-08-07T06:10:52Z")

</div>

oh 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:** [August 7, 2003, 6:37am UTC](https://forum.kirupa.com/t/button-loadmovie-question/27838/5 "2003-08-07T06:37:52Z")

</div>

Didn’t we talk about this already, Shane? :-  
[AS]Button.prototype.removeButton = MovieClip.prototype.removeMovieClip;  
Button.prototype.swapDepths = MovieClip.prototype.swapDepths;  
//  
myButton.swapDepths(100);  
myButton.removeButton();[/AS]  
Right… the Tylenol. 😉

---

<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 7, 2003, 6:42am UTC](https://forum.kirupa.com/t/button-loadmovie-question/27838/6 "2003-08-07T06:42:35Z")

</div>

Yeah, we did, and we also talked about me being an idiot before too, so we see that is true too 😉

---

<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 7, 2003, 1:03pm UTC](https://forum.kirupa.com/t/button-loadmovie-question/27838/7 "2003-08-07T13:03:59Z")

</div>

So, I use the one above?  
And where do I apply it?

Just a bit more info please?

---

<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 7, 2003, 4:18pm UTC](https://forum.kirupa.com/t/button-loadmovie-question/27838/8 "2003-08-07T16:18:56Z")

</div>

Hey kax, can you explain what that code does real fast? It turns the button into a movie clip, swaps the depth, and them removes it?

---

<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 7, 2003, 5:55pm UTC](https://forum.kirupa.com/t/button-loadmovie-question/27838/9 "2003-08-07T17:55:56Z")

</div>

- RussianBeer  
Paste this code in the first frame of the movie:  
[AS]Button.prototype.removeButton = MovieClip.prototype.removeMovieClip;  
Button.prototype.swapDepths = MovieClip.prototype.swapDepths;[/AS]  
It doesn’t necessarily have to be first frame, just make sure you put before you call those methods.

To remove the Button, use this code:  
[AS]myButton.swapDepths(100);  
myButton.removeButton();[/AS]  
Where _myButton_ is the instance of the Button you’d like to remove.

- grandsp5  
No, it doesn’t turn the Button into a MovieClip. I’m just copying the MovieClip methods, removeMovieClip and swapDepths, to the Button object. After that, yes, it swaps the Button to a removable depth (0 to 1048575) and removes it.

[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=16877](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=16877)
