PDA

View Full Version : [FMX] question about a working button fader :)



MZA
February 20th, 2005, 09:07 PM
Hey everyone. Im not the best actionscripter but i figure my way out of things.
Heres my question about oddly enough a working script. heh..
I made a button that fades up a movieclip and then the movieclip keeps fading down and up until on rollout where it fades it down. Now, i use a delete this.onEnterFrame; on the fade out button but im not sure if i should delete this.onEnterFrame in the functions where i fade up and down aswell. If so where/how?
Also, you guys probably know a better solution for this so feel free to post that aswell, but pls post answer for the first question aswell so i learn it. (Im probably doing something wrong too, as always.)
Here is the AS:


fadein = function(){
if (white_1._alpha<=100) {
white_1._alpha += 5;
} else{
this.onEnterFrame = fadeout;
}
}
fadeout = function(){
if (white_1._alpha>=0) {
white_1._alpha -= 5;
} else{
this.onEnterFrame = fadein;
}

}
fadeout2 = function(){
if (white_1._alpha>=0) {
white_1._alpha -= 5;
} else{
delete this.onEnterFrame;
}

}

And for the button:

on(rollOver){
this.onEnterFrame = function(){
fadein();
}
}
on(rollOut){
this.onEnterFrame = function(){
fadeout2();
}
}


Thanks for any help! :)

superNoobice
February 20th, 2005, 09:28 PM
maybe because the function you were calling isnt a complete path. try adding _root to the function when you call them. maybe it would work?

MZA
February 20th, 2005, 09:32 PM
maybe because the function you were calling isnt a complete path. try adding _root to the function when you call them. maybe it would work?
hehe...i dont think u really red my question. Its allready working. I just want to know if i need a delete this.onEnterFrame on the two first fade up/down functions.
Thanks for the try tho! ;D