John Carney
asked on
Flash code that makes a SWF on a web page fade in upon mouseover
Can someone post an example of the accepted solution to this question? Or an excruciatingly detailed explanation of everything in both the flash movie and the web page? :-) For example. must I do this in an AS 3.0 flash file or AS 2.0 or either?
https://www.experts-exchange.com/questions/23997358/Flash-mouseover-fade-image-in-out.html
Thanks!
John
https://www.experts-exchange.com/questions/23997358/Flash-mouseover-fade-image-in-out.html
Thanks!
John
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
simply change .txt to .fla, then open as usual.
ASKER
This works great, thanks! I just posted a followup question to find out how to make the swf link to a url. Please take a look at it: https://www.experts-exchange.com/questions/24247402/Attaching-a-hyperlink-to-a-flash-movie-in-html.html
Thanks,
John
Thanks,
John
Great! Hopefully you understand how the tween class works with that example.
To finish it off a little better here's some more info.
You will notice that if you rollout of the box before the fade-in has finished, the fade-out animation jumps to 100% before fading away, rather than fading from the strength the fade-in reached.
So to prevent this, instead of specifying a number for the alpha value, you can use the alpha value of the movieclip.
Look carefully at the code below and see where I have replaced the staring values of 0 and 100 with red_button_mc._alpha
To finish it off a little better here's some more info.
You will notice that if you rollout of the box before the fade-in has finished, the fade-out animation jumps to 100% before fading away, rather than fading from the strength the fade-in reached.
So to prevent this, instead of specifying a number for the alpha value, you can use the alpha value of the movieclip.
Look carefully at the code below and see where I have replaced the staring values of 0 and 100 with red_button_mc._alpha
red_button_mc.onRollOver = function () {
// (movieclip you are targetting,attribute you are animating,style of tween,start value, end value,number of seconds,true is using seconds or false if using milliseconds)
var fade:Tween = new Tween(red_button_mc, "_alpha", Regular.easeOut, red_button_mc._alpha, 100, 2, true);
fade.onMotionFinished = function() {
//do something here when the fade has completed.
};
}
red_button_mc.onRollOut = function () {
// (movieclip you are targetting,attribute you are animating,style of tween,start value, end value,number of seconds,true is using seconds or false if using milliseconds)
var fade:Tween = new Tween(red_button_mc, "_alpha", Regular.easeOut, red_button_mc._alpha, 0, 2, true);
fade.onMotionFinished = function() {
//do something here when the fade has completed.
};
}
ASKER