Estoy desarrollando una presentación interactiva en FLASH, tengo un contenedor con las que llamo los demás swf. Ahora que trato de ingresar el sonido de fondo necesito un script que me ponga pausa a mi sonido, normalmente estoy usando este código pero al activar el sonido se adelanta casi 3 segundos.
Cita:
import flash.media.Sound;
import flash.media.SoundChannel;
var soundOn:Boolean = true; //music is ON when we start
var myMusic:TitleMusic = new TitleMusic();
var myChannel:SoundChannel = myMusic.play(0,1000); // endless loop, in effect
var myTransform:SoundTransform;
mySoundButton.addEventListener(MouseEvent.CLICK,to ggleSound);
mySoundButton.buttonMode = true;
mySoundButton.mouseChildren = false;
function toggleSound(e:MouseEvent)
{
if(soundOn)
{
// turn sound off
myTransform = new SoundTransform();
myTransform.volume = 0; // silent
myChannel.soundTransform = myTransform;
soundOn = false;
mySoundButton.myButtonText.text = "click to turn sound ON";
}
else // sound is off
{
// turn sound on
myTransform = new SoundTransform();
myTransform.volume = 1; // full volume
myChannel.soundTransform = myTransform;
soundOn = true;
mySoundButton.myButtonText.text = "Apagado";
}
}
import flash.media.SoundChannel;
var soundOn:Boolean = true; //music is ON when we start
var myMusic:TitleMusic = new TitleMusic();
var myChannel:SoundChannel = myMusic.play(0,1000); // endless loop, in effect
var myTransform:SoundTransform;
mySoundButton.addEventListener(MouseEvent.CLICK,to ggleSound);
mySoundButton.buttonMode = true;
mySoundButton.mouseChildren = false;
function toggleSound(e:MouseEvent)
{
if(soundOn)
{
// turn sound off
myTransform = new SoundTransform();
myTransform.volume = 0; // silent
myChannel.soundTransform = myTransform;
soundOn = false;
mySoundButton.myButtonText.text = "click to turn sound ON";
}
else // sound is off
{
// turn sound on
myTransform = new SoundTransform();
myTransform.volume = 1; // full volume
myChannel.soundTransform = myTransform;
soundOn = true;
mySoundButton.myButtonText.text = "Apagado";
}
}