Ver Mensaje Individual
  #5 (permalink)  
Antiguo 15/08/2006, 16:22
Avatar de jahepi
jahepi
Colaborador
 
Fecha de Ingreso: diciembre-2004
Ubicación: Querétaro
Mensajes: 1.124
Antigüedad: 19 años, 4 meses
Puntos: 43
Código:
var $sonido:Sound = new Sound();
var $intervalo:Number = 0;
var $segundos:Number = 5;

$sonido.loadSound("frog.mp3", false);
$sonido.onLoad = function($cargado:Boolean):Void
{
	if($cargado) this.start();
	else trace("Hubo un problema al cargar el MP3.");
}

$sonido.onSoundComplete = function():Void
{
	trace("MP3 terminado.");
	//Volvemos a reproducir en un tiempo aleatorio.
	var $tiempo:Number = Math.random() * ($segundos * 1000);
	$intervalo = setInterval(Reproducir, $tiempo);
	trace("El sonido se reproducira en: " + $tiempo / 1000 + " segundos");
	
}

function Reproducir():Void
{
	clearInterval($intervalo);
	$sonido.start();
}

Un saludo!