Comunidad de diseño web y desarrollo en internet online

Controlar el volumen sin soltar el movie clip con el mouse

Citar            
MensajeEscrito el 22 Jul 2007 05:20 am
Buenas...
Estoy haciendo un reproductor de mp3, y quiero hacer el control de volumen, por medio de un barra deslizadora (slider), me sale bien, el tema es que solo me actualiza el volumen de los temas, cuando suelto el boton, (slider), como puedo hacer para que me actualice el volumen, sin que suelte el boton?
Mi idea empezo, aprendiendo a usar los XML en flash, luego, a tratar el tema de los ID3, y asi fueron surgiendo dudas sobre las cuales aprendi sobre la marcha, pero el tema del volumen "al vuelo", no me sale. Lei por ahi que con setInterval, se puede lograr, pero no le entiendo muy bien. Aca les dejo el codigo de lo que arme.
Desde ya gracias.

Código :

//********************************************************
//Control de volumen con slider
//********************************************************
volume_mc.top = volume_mc._y;
volume_mc.bottom = volume_mc._y;
volume_mc.left = volume_mc._x;
volume_mc.right = volume_mc._x + 100;
volume_mc._x += 100;

volume_mc.handle_btn.onPress = function() {
   startDrag(this._parent, false, this._parent.left, this._parent.top, this._parent.right, this._parent.bottom);
}

volume_mc.handle_btn.change = function() {
   this._parent._parent.sound.setVolume(level);   
}

volume_mc.handle_btn.onRelease = function() {
   stopDrag();
   var level:Number = Math.ceil(this._parent._x - this._parent.left);
   this._parent._parent.sound.setVolume(level);
}

volume_mc.handle_btn.onReleaseOutside = slider_mc.handle_btn.onRelease;
//********************************************************

Por devc

56 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 22 Jul 2007 10:37 am
Dentro0 del evento onPress tendrás que meter un evento onEnterFrame, o mejor, onMouseMove que vaya cambiando el volumen. Después, en el evento onRelease, borras el evento que has creado con tuMc.onMouseMove = null;

Por Zah

BOFH

4290 de clabLevel

27 tutoriales
5 articulos

  Bastard Operators From Hell Editores

Zaragoza, España

firefox
Citar            
MensajeEscrito el 22 Jul 2007 05:42 pm
Hola Zah,

Probe con los datos que me diste y no me funciona...
Hice esto:

Código :

//********************************************************
//Control de volumen con slider
//********************************************************
volume_mc.top = volume_mc._y;
volume_mc.bottom = volume_mc._y;
volume_mc.left = volume_mc._x;
volume_mc.right = volume_mc._x + 100;
volume_mc._x += 100;

volume_mc.handle_btn.onPress = function() {
   startDrag(this._parent, false, this._parent.left, this._parent.top, this._parent.right, this._parent.bottom);
}

volume_mc.handle_btn.onRelease = function() {
   stopDrag();
//   var level:Number = Math.ceil(this._parent._x - this._parent.left);
//   this._parent._parent.sound.setVolume(level);   
}
var mList:Object=new Object();
mList.onMouseMove = function() {
   var level:Number = Math.ceil(this._parent._x - this._parent.left);
   volume_mc.handle_btn._parent._parent.sound.setVolume(level);   
   updateAfterEvent();
}

volume_mc.handle_mc.addListener(mList);
/*
volume_mc.handle_btn.onMouseMove = function() {
   var level:Number = Math.ceil(this._parent._x - this._parent.left);
   this._parent._parent.sound.setVolume(level);   
   updateAfterEvent();
}
*/

volume_mc.handle_btn.onReleaseOutside = slider_mc.handle_btn.onRelease;
//********************************************************

//********************************************************
//Parser de la lista de musica con el XML
//********************************************************
myMusic.ignoreWhite = true;
myMusic.onLoad = function(success) {
   nMusic = this.firstChild.childNodes.length;
   
   for(var i=0; i<nMusic; i++) {
      listMusic.addItem({
                       label:this.firstChild.childNodes[i].firstChild.nodeValue,
                     data:"music/" + this.firstChild.childNodes[i].firstChild.nodeValue
                    });
   }
}
myMusic.load("lista.xml");
//********************************************************


en que le estoy errando?
Gracias

Por devc

56 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 22 Jul 2007 05:50 pm
Aqui agrego otra modificacion que le hice al codigo y tampoco pasa nada:

Código :

//********************************************************
//Control de volumen con slider
//********************************************************
volume_mc.top = volume_mc._y;
volume_mc.bottom = volume_mc._y;
volume_mc.left = volume_mc._x;
volume_mc.right = volume_mc._x + 100;
volume_mc._x += 100;

volume_mc.handle_btn.onPress = function() {
   startDrag(this._parent, false, this._parent.left, this._parent.top, this._parent.right, this._parent.bottom);
   this.onMouseMove = function() {
      level = Math.ceil(this._parent._x - this._parent.left);
      this._parent._parent.sound.setVolume(level);   
   }
}

volume_mc.handle_btn.onRelease = function() {
   this.onMouseMove = null;
   stopDrag();
//   level = Math.ceil(this._parent._x - this._parent.left);
//   this._parent._parent.sound.setVolume(level);   
}

volume_mc.handle_btn.onReleaseOutside = slider_mc.handle_btn.onRelease;
//********************************************************


Saludos!

Por devc

56 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 22 Jul 2007 06:28 pm
Listo!
Ya lo logre el codigo quedo asi:

Código :

//********************************************************
//Control de volumen con slider
//********************************************************
volume_mc.top = volume_mc._y;
volume_mc.bottom = volume_mc._y;
volume_mc.left = volume_mc._x;
volume_mc.right = volume_mc._x + 100;
volume_mc._x += 100;

volume_mc.handle_btn.onPress = function() {
   startDrag(volume_mc, false, volume_mc.left, volume_mc.top, volume_mc.right, volume_mc.bottom);
   Mouse.addListener(raton);
}

raton.onMouseMove = function() {
   level = Math.ceil(volume_mc._x - volume_mc.left);
   sound.setVolume(level);   
}

volume_mc.handle_btn.onRelease = function() {
   stopDrag();
   Mouse.removeListener(raton);
}

volume_mc.handle_btn.onReleaseOutside = slider_mc.handle_btn.onRelease;


Gracias!

Por devc

56 de clabLevel



Genero:Masculino  

firefox

 

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