# Fade out MC with button // my code

**URL:** <https://forum.kirupa.com/t/fade-out-mc-with-button-my-code/114843>\
**Category:** Uncategorized\
**Created:** [July 2, 2004, 8:25am UTC](https://forum.kirupa.com/t/fade-out-mc-with-button-my-code/114843 "2004-07-02T08:25:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgyboy](https://avatars.discourse-cdn.com/v4/letter/g/9de0a6/32.png) [@georgyboy](https://forum.kirupa.com/u/georgyboy)\
**Post date:** [July 2, 2004, 8:25am UTC](https://forum.kirupa.com/t/fade-out-mc-with-button-my-code/114843/1 "2004-07-02T08:25:22Z")

</div>

on (release){  
\_root.drew.\_visible =false;  
gotoAndPlay(31);  
}

above is my code which i m using to try and fade out a MC when a button is pressed. The button (and the picture it shows when pressed) are within the same MC. I have placed this MC onthe root timeline and givene the MC i want to fade out the instance name drew // but still not having any luck making invisible. Ideas?? Thanks

---

<div class="post-metadata">

**Author:** ![aaron353](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@aaron353](https://forum.kirupa.com/u/aaron353)\
**Post date:** [July 28, 2004, 5:39pm UTC](https://forum.kirupa.com/t/fade-out-mc-with-button-my-code/114843/2 "2004-07-28T17:39:28Z")

</div>

how would i write this code

```
if (_root.drew._alpha=100) {
	_root.drew.onEnterFrame = function() {
		_root.drew._alpha -= 15;
	};
} else {
	delete _root.drew.onEnterFrame;
}

```

to use it on a frame with a fade in on entry of a frame that is loadign a external swf and then have it fade out when leaving the frame?

THANKS! 🙂
