Comunidad de diseño web y desarrollo en internet online

Problemas con Mp3 en as3

Citar            
MensajeEscrito el 10 Jun 2008 09:46 pm
Problemas con reproduccion de mp3.
tengo un problema con el siguiente codigo.



var sound:Sound=new Sound(new URLRequest("young.mp3"));
var chan:SoundChannel = sound.play(0)
var playing = true
var currentTime = 0
function sound_play_pause(e:MouseEvent){
playing = !playing
if(!playing) {
currentTime = chan.position
chan.stop()
} else {
chan = sound.play(currentTime)
}
}
function sound_Stop(e:MouseEvent){
playing = !playing;
chan.stop();
currentTime=0;
}
play_btn.addEventListener(MouseEvent.CLICK, sound_play_pause);
stop_btn.addEventListener(MouseEvent.CLICK, sound_Stop);


bueno me da la pausea de la cancion y el stop para q vuelva a iniciar. Pero el problemea es que cuando termina la cancion hay q apretar stop para que vuelva a iniciar, tal vez se podria hacer algo para que este detecte cuando la cancion ya aya terminado y presionar play y vuelva a iniciarce sin apretar stop.

Por tomili

36 de clabLevel



Genero:Masculino  

Arequipa-Perú

firefox
Citar            
MensajeEscrito el 10 Jun 2008 10:21 pm
Agrégale un listener al evento complete

sound.addEventListener(Event.COMPLETE, hacerAlgo)

Y ya lo vuelves a reproducir

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox

 

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