Ver Mensaje Individual
  #2 (permalink)  
Antiguo 04/05/2009, 22:28
Avatar de the_ghost
the_ghost
 
Fecha de Ingreso: octubre-2003
Ubicación: Caracas, Venezuela
Mensajes: 104
Antigüedad: 20 años, 6 meses
Puntos: 5
Respuesta: boton flash que encienda y apague el sonido

Hola. Supongo que ya tienes el botón hecho. Si el botón se llama btn, debes agregar estas acciones, reemplazando URL_del_MP3 por la ubicación de tu MP3:

var snd:Sound;
var chan:SoundChannel;
btn.addEventListener(MouseEvent.CLICK, playSound);


function playSound(e:MouseEvent) {
if (snd == null) {
snd = new Sound();
snd.load(new URLRequest("URL_del_MP3"));
}
chan = snd.play();
btn.removeEventListener(MouseEvent.CLICK, playSound);
btn.addEventListener(MouseEvent.CLICK, stopSound);
}

function stopSound(e:MouseEvent) {
chan.stop();
btn.removeEventListener(MouseEvent.CLICK, stopSound);
btn.addEventListener(MouseEvent.CLICK, playSound);
}
__________________
ThE GhOsT