Alpha fade on mouseover

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

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

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;
		}
	};
}

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.

Same way as on a button…

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

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

Just like on any button.

forgot to put _root. thx again :slight_smile:

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