allora:
come prima cosa dai un nome istanza al mc dell'omino (per esempio "omino_mc")
poi dalla libreria dai un nome concatenamento (linkage) alla traccia audio (per esempio "musica")
poi nel primo frame, nella timeline, scrivi
codice:
//FUNZIONE SUONO
function playSound(soundID) {
soundobject.setVolume(100);
soundobject = new Sound(this);
soundobject.attachSound(soundID);
soundobject.start(posSound, 1);
soundobject.onSoundComplete = function() {
soundobject.start(0, 1000);
};
}
nomeFrame = "";
e nel secondo, sempre nella timeline, scrivi:
codice:
stop();
playSound("musica");
omino_mc.onPress = function() {
posSound = Math.round((soundobject.position)/1000);
trace(posSound);
trace(nomeFrame);
if (nomeFrame == "statico") {
this.play();
playSound("musica");
nomeFrame = "";
} else {
soundobject.stop();
this.stop();
nomeFrame = "statico";
}
};
Spero di esserti stata utile.
Lorenza