hey - trying to get an if/else statement working for an audio fade.
I want the audio to fade in if the volume is set to zero otherwise it means the volume is already set to 100 or the audio has been shut off. I can’t seem to get it working both ways.
here is the if/else i am trying to get working:
if (_global.musicplaying == true) {
if (bgmusic.vol =! 100) {
(_root.fade=!_root.fade) ? 1 : 0;
} else {
null();
}
}
and here is the actual code controlling the fade:
var vol = 100;
var step = 20;
var fade = 0;
onEnterFrame = function () {
// set fade out
if (fade) {
vol = vol-step;
if (vol<0) {
vol = 0;
}
bgmusic.setVolume(vol);
// set fade in
} else {
vol = vol+step;
if (vol>100) {
vol = 100;
}
bgmusic.setVolume(vol);
}
};
Thanks in advance.