package clases{
	import flash.media.Sound;
	import flash.net.URLRequest;
	import flash.media.SoundLoaderContext;
	import flash.events.Event;
	import flash.media.SoundMixer
	import flash.media.SoundChannel;
	import flash.display.Sprite;
	
	public class cadenaSonido extends Sprite {
			
			
			public var link:URLRequest
			public var sonidos:Array
			public var bufer:SoundLoaderContext
			public var maximo:int
			public var nodo:int
			private var canal:SoundChannel = new SoundChannel()
			
		public function cadenaSonido(sonidosPasados:Array) {
			
			nodo = 0
			sonidos =  sonidosPasados
			
			bufer = new SoundLoaderContext(100)
			maximo = sonidos.length	
			
			reproducir(nodo)	
				
		}
		public function reproducir(nodo){
			link = new URLRequest(sonidos[nodo])
			var son:Sound = new Sound()
			son.load(link)
			canal = son.play(0)
			canal.addEventListener(Event.SOUND_COMPLETE,completo)
			
			}
		public function  completo(e){
			//trace("coppleto")
			if(nodo < maximo-1){
			nodo++
			reproducir(nodo)	
			}}
	}
	
}
