Animated Image Fading

Yo Yo Again,

Don’t mean to be a bothering pest or w/e but does anyone know how to make animated buttons that fade images in when you put your mouse over them. So when someone hovers over a button, the image fades in and when their mouse moves off the button, the image fades out.

Thanks dudes :wink:

use the hitTest function - do a loop that increases the transparency while the mouse is over (= hitTest is true) or that decreases the transperency (more opaque) when the mouse isnt over it…

hmmm…
I dont understand.
Im not to good with actionscript etc…

onEnterFrame = function() {
hitTest(_root._xmouse, _root._ymouse, true) ? alpha = 100 : alpha = 20;
_alpha += (alpha - _alpha) /5
}

how do i use that? where do i put it?

<embed src=http://membres.lycos.fr/mlkdesign/kirupa/hittest.swf height=140 width=140 type=application/x-shockwave-flash>

http://membres.lycos.fr/mlkdesign/kirupa/hittest.fla

I wrote everything on the first MC… It’s similar to fluid’s code without the advanced syntax. Basically when the mouse cursor is over the MC (which has a button inside) actionscripts increases transparency and vice versa:


onClipEvent (enterFrame) {
	if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
		if (this._alpha>20) {
			this._alpha -= 10;
		}
	} else {
		if (this._alpha<=100) {
			this._alpha += 5;
		}
	}
}

so many ways to do the same thing…

myMovieClip.onEnterFrame = function() {
	this._alpha = Math.min(Math.max(20, this._alpha+(this.hitTest(_root._xmouse, _root._ymouse) ? 5 : -5)), 100);
};

:stuck_out_tongue:

hehe :crazy: