Ciao, scusa se non ho risposto prima.
Estrai il file compresso sound.rar
Metti la cartella "sound" (con dentro le sottocartelle mp3, script, src, swf) sulla root principale del tuo server.
(La cartella mp3 conterrà i file audio)
nel file con la mappa di immagini devi collegare un unico file:
<head>
...
<script type="text/javascript" src="/sound/script/soundmanager2-nodebug-jsmin.js"></script>
...
</head>
sempre nell'head, devi inizializzare lo script:
codice:
var mySound;
soundManager.url = '/sound/swf/';
soundManager.onready(function(){
mySound = soundManager.createSound({
id: 'aSound',
url: '/sound/mp3/tada.wav'//qui indichi il file audio che vuoi riprodurre
});
});
Il tuo head apparirà all'incirca così:
codice:
<head>
...
<script type="text/javascript" src="/sound/script/soundmanager2-nodebug-jsmin.js"></script>
<script type="text/javascript">
var mySound;
soundManager.url = 'swf/'; // directory where SM2 .SWFs live
soundManager.onready(function(){
mySound = soundManager.createSound({
id: 'aSound',
url: 'mp3/tada.wav'//file audio, sono supportati vari formati: mp3, wav, ecc.
});
});
function visualizza(id){
if (document.getElementById){
if(document.getElementById(id).style.display == 'none'){
document.getElementById(id).style.display = 'block';
mySound.play();//questo è il comando che riproduce il suono
//verrà eseguito ogni volta che richiami la funzione "visualizza() con onmouseover="visualizza(id_elemento)"
}else{
document.getElementById(id).style.display = 'none';
mySound.stop();// Stoppa il suono onmouseout, cancella questo rigo se vuoi che il suono continui sono alla fine.
}
}
}
</script>
...
</head
Per rispondere alla tua domanda, con questo script, il suono viene riprodotto per ogni area sensibile che ha, nell'evento onmouseover, la funzione "visualizza".
Sarebbe possibile riprodurre il suono solo per alcune aree, o assegnare un suono personalizzato per ogni area.
Fammi sapere se vuoi ottenere un risultato diverso.