PDA

View Full Version : dynamic fading question...


lengstoRf
01-04-2005, 11:00 PM
i'm trying to use AS2 to cause a movie clip to fade to a certain alpha value using onClipEvent(enterFrame)...

...my goal is to set the initial alpha of the movie clip to 0, then, once a button is pressed, set the alpha to 50. the reason i want to use AS to do this is so that the fade isn't repeated if the button is pressed again...

...i'm a total noob at AS programming, so i'm sure i'm completely off-base here, but here's what i tried (this AS is placed on my movie clip):

onClipEvent(load){
var alpha = 0;
_alpha = 0;
speed = 5;
}

onClipEvent(enterFrame){
_alpha += (alpha - _alpha)/speed;
}

on each button i have:

on(release){
alpha = 50;
}

the button script i know is wrong. i'm not sure about my actual function...

...any help is greatly appreciated. thanks in advance!

Tink
01-07-2005, 01:48 PM
penners (or laco's) tween are by far the easiest way to tween using AS. http://www.flashgroup.net/forum/showthread.php?t=2268&highlight=penner take a look towards the end of that thread, for more info on penners