PDA

View Full Version : Fade script



biscuit
April 12th, 2003, 06:17 AM
I left my brain at the pub last night and now I can't make this easy peasy script work.

I have two buttons and an MC.

Button one fades the MC in
Button two fades the MC out.


Here's my fade function

function alphaFade(dir, whichClip, rate){
if(dir== true){


_root[whichClip]._alpha = _root[whichClip]._alpha+rate;
}
if(dir == false){


_root[whichClip]._alpha = _root[whichClip]._alpha-rate;
}
}

For some reason you can fade the MC in but the other button fails to fade it out. ( I also tried it the other way round ie. different starting alpha)

Please help. Thanks in advance.

ahmed
April 12th, 2003, 06:33 AM
button 1
on (release) {
mymovieclip.onEnterFrame = function() {
(this._alpha>99) ? delete this.onEnterFrame : this._alpha++;
};
} button 2
on (release) {
mymovieclip.onEnterFrame = function() {
(this._alpha<1) ? delete this.onEnterFrame : this._alpha--;
};
}

:beam:

biscuit
April 12th, 2003, 06:36 AM
That'll be the one! Cheers! I need help with just about everything today!

Thanks for your swiftness Ahmed. :)