fade in on rollover button and fade out when leaving the button
How can I make an image fade in on a rollover button and fade out when leave the button
How can I make an image fade in on a rollover button and fade out when leave the button
Hi George
I made an alternative example utilizing TweenJS (part of CreateJS). This involves one Movieclip to fade in/out and one button to mouseover/mouseout.
The movieclip in my example is instance named "image",
the button is named "button". Both can be named anything but must be reflected in this script:
var tln = this;
tln.image.alpha = 0;
this.button.on("mouseover", function () {
createjs.Tween.get(tln.image, {
override: true
}).to({
alpha: 1
}, 1000, createjs.Ease.easeNone);
});
this.button.on("mouseout", function () {
createjs.Tween.get(tln.image, {
override: true
}).to({
alpha: 0
}, 1000, createjs.Ease.easeNone);
});
In both Tweens the parameter {override: true} is important to stop (override) one incompleted tween if the opposite tween is called. For fast changes between mouseover and mouseout.
Here is the example to download: Dropbox - bananas.zip
Klaus
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.