5/27/2011 1:43:26 PM
Title:
student
Hello! I'm using AS2. This is to make the movie clip (startBtn) fade in and out with a mouse over, also, it will bring me to frame 2 when I click on it.
on (release) {
gotoAndStop(2);
fadeAmount = 20;
function fadeIn() {
startBtn._alpha += fadeAmount;
if (startBtn._alpha>=100) {
startBtn._alpha = 100;
startBtn.onEnterFrame = null;
}
}
function fadeOut() {
startBtn._alpha -= fadeAmount;
if (startBtn._alpha<=0) {
startBtn._alpha = 0;
startBtn.onEnterFrame = null;
}
}
startBtn._alpha = 0;
startBtn.onRollOver = function() {
startBtn.onEnterFrame = fadeIn;
}
startBtn.onRollOut = function() {
startBtn.onEnterFrame = fadeOut;
}
}
Here is the problem...
When I use this on a Button - This action script allows me to go to the next frame, but the fade doesn't work.
When I use this on a Movie Clip - The fade works, but it doesn't allow me to go to the next frame.
Thanks in advance!
Inder
Points: 2980
Posts:0
5/28/2011 12:20:23 PM
In movieclip case you are inside movieclip so you need to tell that you want to move the root timeline to next frame for this use _root.gotoAndStop(2);
5/28/2011 7:13:55 PM
Sir, you are the boss. Thank you! It worked!
5/31/2011 3:01:01 PM
Hello again! Thank you for your help from the last reply by the way. I have one more question regarding multiple movie clip buttons in the same frame in the timeline.
Now that I have the movie clip button working with alpha fades, how do I go about using this on multiple buttons on the same frame? This is what I tried to do below...
fadeAmount = 20;
function fadeIn() {
startBtn._alpha += fadeAmount;
if (startBtn._alpha>=100) {
startBtn._alpha = 100;
startBtn.onEnterFrame = null;
}
}
function fadeOut() {
startBtn._alpha -= fadeAmount;
if (startBtn._alpha<=0) {
startBtn._alpha = 0;
startBtn.onEnterFrame = null;
}
}
startBtn._alpha = 0;
startBtn.onRollOver = function() {
startBtn.onEnterFrame = fadeIn;
}
startBtn.onRollOut = function() {
startBtn.onEnterFrame = fadeOut;
}
fadeAmount = 10;
function fadeIn() {
continueBtn._alpha += fadeAmount;
if (continueBtn._alpha>=50) {
continueBtn._alpha = 50;
continueBtn.onEnterFrame = null;
}
}
function fadeOut() {
continueBtn._alpha -= fadeAmount;
if (continueBtn._alpha<=0) {
continueBtn._alpha = 0;
continueBtn.onEnterFrame = null;
}
}
continueBtn._alpha = 0;
continueBtn.onRollOver = function() {
continueBtn.onEnterFrame = fadeIn;
}
continueBtn.onRollOut = function() {
continueBtn.onEnterFrame = fadeOut;
}
If I add the same code below the original but replace startBtn with continueBtn, I don't get any errors, but the alpha fades stop working properly. Any idea how to resolve this issue? Thanks again in advance!
6/2/2011 9:42:06 AM
use a different variable for "fadeAmount " like fadeAmount1 for your continueBtn code and it should work