Comunidad de diseño web y desarrollo en internet online

Como eliminar sonidos de un clip de pelicula

Citar            
MensajeEscrito el 05 Sep 2011 12:31 am
Saludos, a todos, necesito una ayuda, tengo este movieclip que lo llamo desde la parte principal, corre bien... pero lo que necesito es hacer una función para poder llamar a otro mp3
la variable que uso es : MovieClip(root).variable que la envio desde la pelicula principal

lo que no logro es detener ni llamar a otro mp3


Código Javascript :

stop();
// Assign The URL to the mp3 to play

var req:URLRequest = new URLRequest(MovieClip(root).variable);
// Boolean value for button functions, to switch in the conditionals
var isPlaying:Boolean = true;
// Create the sound object
var snd:Sound = new Sound(req);
// Assign a var name for the sound channel
var channel:SoundChannel;
// Pause position variable
var pausePosition:Number = 0;
// Start Playing
channel = snd.play(pausePosition);
// Make Play button change cursor to click hand
playBtn.buttonMode = true;
// Move the play/pause button movieclip to frame 2(active state)
playBtn.gotoAndStop(2);
// Play Button Listener
playBtn.addEventListener(MouseEvent.CLICK, playPause);
channel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);
// On playback complete function  ///////////////////////////////////
function onPlaybackComplete(event:Event) {
       //trace("The sound has finished playing.");
      pausePosition = 0;
      channel = snd.play(pausePosition);
      isPlaying = true;
      channel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);
}
// Play/Pause button function ////////////////////////////////////////
function playPause(event:MouseEvent):void {

   // This conditional makes the magic of our play/pause functionality
    if (isPlaying == false) {
       channel = snd.play(pausePosition); // Start playing
      isPlaying = true; // Set the isPlaying Boolean to true
      playBtn.gotoAndStop(2); // Move the play/pause button movieclip to frame 2
      channel.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);
    } else {
      pausePosition = channel.position;
       channel.stop(); // Stop Playing
      playBtn.gotoAndStop(1); // Move the play/pause button movieclip to frame 2(paused)
       isPlaying = false; // Set the isPlaying Boolean to false
    }

}



gracias por la atencion prestada

Por xamla22

21 de clabLevel



 

chrome
Citar            
MensajeEscrito el 05 Sep 2011 03:16 am
esta es la funcion que estoy implementando en el movieclip

Código Javascript :

function stopSound(event:MouseEvent):void {
channel.stop();
pausePosition = 0;
isPlaying = false;
}


este en el principal...
el boton que me deveria eliminar el sonido

Código Javascript :

v_mc.addEventListener (MouseEvent.CLICK, function () {volverC(v_mc,t_S,mus)});


y la funcion que llamo para que me la elimine

Código Javascript :

function volverC (clip_1, clip_2, clip_3):void{
   clip_3.req = null;
   clip_3.snd = null;
   clip_3.stopSound();
clip_1.parent.removeChild(clip_1);
clip_2.parent.removeChild(clip_2);
clip_3.parent.removeChild(clip_3);

}


me funciona hasta eliminar los clip de pelicula, pero no para el sonido... ???

Por xamla22

21 de clabLevel



 

chrome
Citar            
MensajeEscrito el 05 Sep 2011 03:31 am
solucionado

Código Javascript :

function volverC (clip_1, clip_2, clip_3):void{
   clip_3.channel.stop();
   clip_3.pausePosition = 0;
   clip_3.playBtn.gotoAndStop(1);
   clip_3.isPlaying = false;
   clip_1.parent.removeChild(clip_1);
   clip_2.parent.removeChild(clip_2);
   clip_3.parent.removeChild(clip_3);
}


jejeje.... :cool:

contestado yo mismo...

Por xamla22

21 de clabLevel



 

chrome

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.