im curently working on a full flash site and i have a little script that fades in audio and has to fade out audio on button click… but there is something wrong…
this is how it works:
frame 1:
music = new Sound();
music.attachSound("backsound");
music.start(0, 999999);
music.setVolume(0);
vol = 0;
fade = setInterval(fadeIn, 100);
function fadeIn() {
vol += 3;
music.setVolume(vol);
reaches to 100
if (vol>=100) {
clearInterval(fade);
step = 1;
Fade = 0;
}
}
_root.onEnterFrame = function() {
if (Fade == 1) {
vol = vol-step;
if (vol<0) {
vol = 0;
}
music.setVolume(vol);
} else {
vol = vol+step;
if (vol>100) {
vol = 100;
}
music.setVolume(vol);
}
};
on button:
on (release) {
(_root.fade=!_root.fade) ? 0 : 1;
}
(dont forget to lnk the MP3)
somehow i cant get this to work? :*(