# Alpha fade on mouseover

**URL:** <https://forum.kirupa.com/t/alpha-fade-on-mouseover/7914>\
**Category:** Uncategorized\
**Created:** [November 10, 2002, 6:54am UTC](https://forum.kirupa.com/t/alpha-fade-on-mouseover/7914 "2002-11-10T06:54:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![slayerment](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@slayerment](https://forum.kirupa.com/u/slayerment)\
**Post date:** [November 10, 2002, 6:54am UTC](https://forum.kirupa.com/t/alpha-fade-on-mouseover/7914/1 "2002-11-10T06:54:37Z")

</div>

would anyone know the AS way to make a button fade from say 40% alpha to 100% when the mouse rolls over it?  
thx!

---

<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:** [November 10, 2002, 7:11am UTC](https://forum.kirupa.com/t/alpha-fade-on-mouseover/7914/2 "2002-11-10T07:11:51Z")

</div>

Put this on a Movie Clip (yes, MX allows Movie Clips to be used as buttons, which totally rocks!)…

```auto
onClipEvent (load) {
	this._alpha = 40;
}
on (rollOver) {
	this.onEnterFrame = function() {
		this._alpha += 5;
		if (this._alpha>=100) {
			this._alpha = 100;
			delete this.onEnterFrame;
		}
	};
}
on (rollOut) {
	this.onEnterFrame = function() {
		this._alpha -= 5;
		if (this._alpha<=40) {
			this._alpha = 40;
			delete this.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:** [November 10, 2002, 7:49am UTC](https://forum.kirupa.com/t/alpha-fade-on-mouseover/7914/3 "2002-11-10T07:49:29Z")

</div>

wow thx that did the trick. btw, how would i make the mc go somewhere on release? i tried adding some simple code but it did not 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:** [November 10, 2002, 7:56am UTC](https://forum.kirupa.com/t/alpha-fade-on-mouseover/7914/4 "2002-11-10T07:56:30Z")

</div>

Same way as on a button…

```auto
on (release){
_root.clip.gotoAndPlay(1);
}

```

For example.  
Just put that at the end of all the other code.

Just like on any button.

---

<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:** [November 10, 2002, 8:00am UTC](https://forum.kirupa.com/t/alpha-fade-on-mouseover/7914/5 "2002-11-10T08:00:30Z")

</div>

forgot to put \_root. thx 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:** [November 10, 2002, 8:05am UTC](https://forum.kirupa.com/t/alpha-fade-on-mouseover/7914/6 "2002-11-10T08:05:37Z")

</div>

No problem. In the future you will find that using movie clips as buttons is SOOO much better than using buttons… as … buttons…LOL.
