default:
red box//visible
blue box//not visible
green box//not visible
when blue button is click//red box fades out; blue box fades in
when green button is click// any visible box fades out and fades in the green box
when red button is click//any visible box fades out and fades in the red box
only one box is visible at a time
the problem with my code is that… it sometimes have a pause when switching from one button to another. can someone c]heck this please… im still noob at AS.
box1._alpha = 0;
box2._alpha = 100;
box3._alpha = 0;
this.bb1.bb1.onRelease = function() {
clearInterval(fadeInterval)
function fadeOut() {
if ((box2._alpha>0||box3._alpha>0)) {
box2._alpha -= 2;
box3._alpha -= 2;
} else {
clearInterval(fadeInterval);
setTimeout(startOut, 0);
}
}
function fadeIn() {
if (box1._alpha<100) {
box1._alpha += 2;
} else {
clearInterval(fadeInterval);
}
}
function startOut() {
fadeInterval = setInterval(fadeIn, 5);
}
var fadeInterval = setInterval(fadeOut, 5);
}
//=============================================================
this.bb1.bb2.onRelease = function() {
clearInterval(fadeInterval)
function fadeOut() {
if ((box1._alpha>0||box3._alpha>0)) {
box1._alpha -= 2;
box3._alpha -= 2;
} else {
clearInterval(fadeInterval);
setTimeout(startOut, 0);
}
}
function fadeIn() {
if (box2._alpha<100) {
box2._alpha += 2;
} else {
clearInterval(fadeInterval);
}
}
function startOut() {
fadeInterval = setInterval(fadeIn, 5);
}
var fadeInterval = setInterval(fadeOut, 5);
}
//========================================================
this.bb1.bb3.onRelease = function() {
clearInterval(fadeInterval)
function fadeOut() {
if ((box1._alpha>0||box2._alpha>0)) {
box1._alpha -= 2;
box2._alpha -= 2;
} else {
clearInterval(fadeInterval);
setTimeout(startOut, 0);
}
}
function fadeIn() {
if (box3._alpha<100) {
box3._alpha += 2;
} else {
clearInterval(fadeInterval);
}
}
function startOut() {
fadeInterval = setInterval(fadeIn, 5);
}
var fadeInterval = setInterval(fadeOut, 5);
}