I have this code on a button that tells a mc to play when the variable fade is active.
this code is in the timeline
next_mc.onEnterFrame = function() {
if (fade) {
next_mc.nextFrame();
} else {
next_mc.prevFrame();
}
};
on the button i have this code
on (rollOver) {
_root.fade = true;
}
on (rollOut, dragOut) {
_root.fade = false;
}
on (release) {
nextFrame();
play();
}
What i want is to have multiple buttons use the fade variable, the only way i found to do this was to duplicte the timeline code everytime changing the name of the mc i want to target, and keeping the button code the same.
can i write it like this:
next_mc.onEnterFrame = function() {
previous_mc.onEnterFrame = function() {
if (fade) {
next_mc.nextFrame();
previous_mc.nextFrame();
} else {
next_mc.prevFrame();
previous_mc.prevFrame();
}
};
or do i have to write this everytime:
next_mc.onEnterFrame = function() {
if (fade) {
next_mc.nextFrame();
} else {
next_mc.prevFrame();
}
};
previous_mc.onEnterFrame = function() {
if (fade) {
previous_mc.nextFrame();
} else {
previous_mc.prevFrame();
}
};
thanks to anyone who can simplify my fade in fade out code.
e