I have exported the symbol here.
mute.hypesymbol.zip (738.3 KB)
Note.
The export Symbol is already persistent.
This symbol also imports it's own functions.
initMute()
selection()
- generally only import a symbol once into a project if you can, if you import a symbol more than once you duplicate all it's resources which also mean you get multiples of it's functions().
( if this happens you will need to manually remove or rename the duplicate functions )
1, Unzip the symbol.
2, Go to one of the Scenes Layouts that you want it on and use the import Symbol menu.
3, select the unzipped symbol.
The symbol will appear in the scene.
4,Select the symbol in the scene, copy it ( command + c )
5, and then go each of the other layout scenes you want it on and paste it into them ( command + p )
6, for each of the functions that play a sound from a click action that you want the mute to work for.
Open them for edit.
7, where you have the two lines for example.
var a = new Audio("${resourcesFolderName}/blahasblog_ladaengine.mp3");
a.play();
8, wrap them in this if (! window.muteAll ){ }
condition so they look like this
if (! window.muteAll ){
var a = new Audio("${resourcesFolderName}/blahasblog_ladaengine.mp3");
a.play();
}
Suggestion,
This will not work for any sounds that play via a Play Action. i.e for zuruck zum hauptmenu ( return to main menu )buttons.
if you do want it to work for them then create a new zuruckZumHauptmenu() function and put something like this in it.
if (! window.muteAll ){
var a = new Audio("${resourcesFolderName}/blahasblog_ladaengine.mp3");
a.play();
}
setTimeout(function(){
hypeDocument.showSceneNamed('main', hypeDocument.kSceneTransitionCrossfade, 1.1)
}, 350);
Change the zuruck zum hauptmenu buttons actions to only call the zuruckZumHauptmenu() function.
--
The reason I have the scene transition in the function and also in a time out is so the sound plays first and not after the scene has already changed.