Ver Mensaje Individual
  #2 (permalink)  
Antiguo 10/08/2009, 14:00
Avatar de Diegoazul
Diegoazul
 
Fecha de Ingreso: mayo-2007
Ubicación: { Dash Berlin }
Mensajes: 1.879
Antigüedad: 17 años
Puntos: 67
Respuesta: Cómo precargar mp3 externos?

Asi:

Cita:
//Crear un nuevo objeto Sound()
Sonido1 = new Sound();
//Cargamos el sonido con sin streaming
Sonido1.loadSound("remix.mp3",false);
this.onEnterFrame = function() {
//Averiguamos los bytes total del mp3
total = Sonido1.getBytesTotal();
//Lo que vamos cargando
cargado = Sonido1.getBytesLoaded();
//Utilizamos la caja de texto para escribir el porcentaje cargado
trace(Math.round((cargado/total)*100)+"%")

//Si cargado igual a total y
//total es mayor de cero
if (cargado == total && total>0) {
//Reproducimos el sonido
Sonido1.start(0, 1);
//borramos la funcion
delete this.onEnterFrame;}
};
ó asi:

Cita:


var my_sound:Sound = new Sound();
my_sound.onLoad = function(success:Boolean) {
if (success) {
this.start();
trace("fin")
}
};
my_sound.onSoundComplete = function() {

clearInterval(my_interval);
};
my_sound.loadSound("remix.mp3", false);
var my_interval:Number;
my_interval = setInterval(checkProgress, 100, my_sound);
function checkProgress(the_sound:Sound):Void {
trace(Math.round(the_sound.getBytesLoaded()/the_sound.getBytesTotal()*100));

}
__________________
{ Flash }