kingkahuna
07-10-2005, 06:28 AM
I have AS controlling the alpha of each image of a menu. Each image is a Graphic embedded within it's own MovieClip. Using onEnterFrame, RollOver of one MC fades the alpha of the other MCs from 100 to 35, and RollOut brings them back up. As onEnterFrame is a continuous function, the menu images fade more and more each time I rollOver another menu until they disappear! They're supposed to stop at 35!
What AS can I use to stop this continuous fading to zero alpha - I'm guessing it's a conditional - something like, "if the MC is <35, stop fading". Any ideas how I can script this?
Here is the script. I've shortened it to 3 of the 9 menu images, named navyoMC, visionMC and musicMC. I've also included the zipped .fla file.
// NAVYO ROLLOVER FADE DOWN MENU
navyoMC._alpha = 100;
navyoMC.onRollOver = function() {
visionMC.onEnterFrame = function() {
this._alpha -= 20;
if (this._alpha<35) {
delete this.onEnterFrame;
}
};
musicMC.onEnterFrame = function() {
this._alpha -=20
if (this._alpha<35) {
delete this.onEnterFrame;
}
};
};
// NAVYO ROLLOUT FADE UP MENU
navyoMC.onRollOut = function() {
visionMC.onEnterFrame = function() {
this._alpha += 20;
if (this._alpha>100) {
delete this.onEnterFrame;
}
};
musicMC.onEnterFrame = function() {
this._alpha +=20
if (this._alpha>100) {
delete this.onEnterFrame;
}
};
};
// VISION ROLLOVER FADE DOWN MENU
visionMC._alpha = 100;
visionMC.onRollOver = function() {
navyoMC.onEnterFrame = function() {
this._alpha -= 20;
if (this._alpha<35) {
delete this.onEnterFrame;
}
};
musicMC.onEnterFrame = function() {
this._alpha -=20
if (this._alpha<35) {
delete this.onEnterFrame;
}
};
};
// VISION ROLLOUT FADE UP MENU
visionMC.onRollOut = function() {
navyoMC.onEnterFrame = function() {
this._alpha += 20;
if (this._alpha>100) {
delete this.onEnterFrame;
}
};
musicMC.onEnterFrame = function() {
this._alpha +=20
if (this._alpha>100) {
delete this.onEnterFrame;
}
};
};
// MUSIC ROLLOVER FADE DOWN MENU
musicMC._alpha = 100;
musicMC.onRollOver = function() {
visionMC.onEnterFrame = function() {
this._alpha -= 20;
if (this._alpha<35) {
delete this.onEnterFrame;
}
};
navyoMC.onEnterFrame = function() {
this._alpha -=20
if (this._alpha<35) {
delete this.onEnterFrame;
}
};
};
// MUSIC ROLLOUT FADE UP MENU
musicMC.onRollOut = function() {
visionMC.onEnterFrame = function() {
this._alpha += 20;
if (this._alpha>100) {
delete this.onEnterFrame;
}
};
navyoMC.onEnterFrame = function() {
this._alpha +=20
if (this._alpha>100) {
delete this.onEnterFrame;
}
};
};
[B]
What AS can I use to stop this continuous fading to zero alpha - I'm guessing it's a conditional - something like, "if the MC is <35, stop fading". Any ideas how I can script this?
Here is the script. I've shortened it to 3 of the 9 menu images, named navyoMC, visionMC and musicMC. I've also included the zipped .fla file.
// NAVYO ROLLOVER FADE DOWN MENU
navyoMC._alpha = 100;
navyoMC.onRollOver = function() {
visionMC.onEnterFrame = function() {
this._alpha -= 20;
if (this._alpha<35) {
delete this.onEnterFrame;
}
};
musicMC.onEnterFrame = function() {
this._alpha -=20
if (this._alpha<35) {
delete this.onEnterFrame;
}
};
};
// NAVYO ROLLOUT FADE UP MENU
navyoMC.onRollOut = function() {
visionMC.onEnterFrame = function() {
this._alpha += 20;
if (this._alpha>100) {
delete this.onEnterFrame;
}
};
musicMC.onEnterFrame = function() {
this._alpha +=20
if (this._alpha>100) {
delete this.onEnterFrame;
}
};
};
// VISION ROLLOVER FADE DOWN MENU
visionMC._alpha = 100;
visionMC.onRollOver = function() {
navyoMC.onEnterFrame = function() {
this._alpha -= 20;
if (this._alpha<35) {
delete this.onEnterFrame;
}
};
musicMC.onEnterFrame = function() {
this._alpha -=20
if (this._alpha<35) {
delete this.onEnterFrame;
}
};
};
// VISION ROLLOUT FADE UP MENU
visionMC.onRollOut = function() {
navyoMC.onEnterFrame = function() {
this._alpha += 20;
if (this._alpha>100) {
delete this.onEnterFrame;
}
};
musicMC.onEnterFrame = function() {
this._alpha +=20
if (this._alpha>100) {
delete this.onEnterFrame;
}
};
};
// MUSIC ROLLOVER FADE DOWN MENU
musicMC._alpha = 100;
musicMC.onRollOver = function() {
visionMC.onEnterFrame = function() {
this._alpha -= 20;
if (this._alpha<35) {
delete this.onEnterFrame;
}
};
navyoMC.onEnterFrame = function() {
this._alpha -=20
if (this._alpha<35) {
delete this.onEnterFrame;
}
};
};
// MUSIC ROLLOUT FADE UP MENU
musicMC.onRollOut = function() {
visionMC.onEnterFrame = function() {
this._alpha += 20;
if (this._alpha>100) {
delete this.onEnterFrame;
}
};
navyoMC.onEnterFrame = function() {
this._alpha +=20
if (this._alpha>100) {
delete this.onEnterFrame;
}
};
};
[B]