Hello boys and girls, my first post here in this lovely forum:love:
I´m making af movie and I want to be able to mute the audio using a button. How do I go about doing this cause the audio is synced to some animation and when the user turns the audio back on the audio has to re-sync.
I´ve put the audio and animation in its own movie clip.
I have no idea how to accomplish this, would really like some help here.
If you have the music in a different layer spanned out across the timeline I believe (never tried with music) that you could just have the button do a _visible = 0 to make the music stop and then _visible = 1 to make it play again. That SHOULD make it keep its sync but stop playing. I have never tried this with music though it works with normal movie clips and the logic makes sense.
Right-click on the sound file in your library and select “Linkage”. Once there, check “Export for actionscript”, uncheck “export in first frame”, and give it an identifier name, like “music”.
Then drop the the sound file on the timeline where you want it to start, and select “start” as sync. Then put this code on the same frame (if doesn’t work, put it a frame before) with the music.
mySound = new Sound(this);
mySound.attachSound("music");
mySound.setVolume(50);
mySound.stop();
mySound.start(0, 1);
Then you can create mute unmute buttons and put this code on them:
Mute: