Comunidad de diseño web y desarrollo en internet online

problema con reproductor mp3

Citar            
MensajeEscrito el 29 Dic 2008 09:47 pm
hola gente!!

ante todo felices fiestas!
soy conciente de que conozco muy poco de actionScript pero me he animado ha hacer un reproductor bastante precario pero lo quiero terminar. vamos al grano!
este es el script :

stop_btn.onRelease = function() {
stopAllSounds();
};
play_btn.onRelease = function() {
cancion1.start(0,1);
};
cancion1_btn.onRelease = function() {
cancion1.start(0,1);
};
cancion2_btn.onRelease = function() {
cancion2.start(0,1);
};
cancion3_btn.onRelease = function() {
cancion3.start(0,1);
};
cancion4_btn.onRelease = function() {
cancion4.start(0,1);
};
cancion5_btn.onRelease = function() {
cancion5.start(0,1);
};
cancion6_btn.onRelease = function() {
cancion6.start(0,1);
};
cancion7_btn.onRelease = function() {
cancion7.start(0,1);
};
cancion8_btn.onRelease = function() {
cancion8.start(0,1);
};
cancion9_btn.onRelease = function() {
cancion9.start(0,1);
};
cancion1 = new Sound();
cancion1.loadSound("canciones/Black devil disco club - with honey cream.mp3",true);
cancion1.start(0,1);
nombre_txt.text = "Black Devil Disco Club - With honey cream";
album_txt.text = "Eight on eight";
fecha_txt.text = "2007";
lugar_txt.text = "Paris";
soundFinished = true;
cancion1.onSoundComplete = function() {
soundFinished = true;
cancion2 = new Sound();
cancion2.loadSound("canciones/Dzihan & Kamien Orchestra - After.mp3",true);
cancion2.start(0,1);
nombre_txt.text = "Dzihan & Kamien Orchestra - After";
album_txt.text = "Live in Viena";
fecha_txt.text = "2003";
lugar_txt.text = "Alemania - Austria";
cancion2.onSoundComplete = function() {
soundFinished = true;
cancion3 = new Sound();
cancion3.loadSound("canciones/Ellen alien - Alles Sehen.mp3",true);
cancion3.start(0,1);
nombre_txt.text = "Ellen allien - Alles Sehen";
album_txt.text = "";
fecha_txt.text = "2003";
lugar_txt.text = "Alemania";
cancion3.onSoundComplete = function() {
soundFinished = true;
cancion4 = new Sound();
cancion4.loadSound("canciones/Guy Gerber - Late Bloomers.mp3",true);
cancion4.start(0,1);
nombre_txt.text = "Guy Gerber - Late Bloomers";
album_txt.text = "Belly Dancing";
fecha_txt.text = "2007";
lugar_txt.text = "Tel - Aviv";
cancion4.onSoundComplete = function() {
soundFinished = true;
cancion5 = new Sound();
cancion5.loadSound("canciones/Modeselektor - Ziq Zaq.mp3",true);
cancion5.start(0,1);
nombre_txt.text = "Modeselektor - Ziq Zaq";
album_txt.text = "Hello mom!";
fecha_txt.text = "2006";
lugar_txt.text = "Berlin";
cancion5.onSoundComplete = function() {
cancion6 = new Sound();
cancion6.loadSound("canciones/Shout out out out - Forever Indebted.mp3",true);
cancion6.start(0,1);
nombre_txt.text = "Shout out out out - Forever Indebted";
album_txt.text = "Not saying just saying";
fecha_txt.text = "2008";
lugar_txt.text = "Canadá";
cancion6.onSoundComplete = function() {
soundFinished = true;
cancion7 = new Sound();
cancion7.loadSound("canciones/Stereolab - Self Portrait with electric brain.mp3",true);
cancion7.start(0,1);
nombre_txt.text = "Stereolab - Self Portrait with electric brain";
album_txt.text = "Chemical Chords";
fecha_txt.text = "2008";
lugar_txt.text = "London";
cancion7.onSoundComplete = function() {
soundFinished = true;
cancion8 = new Sound();
cancion8.loadSound("canciones/Teddybears -magic kraut.mp3",true);
cancion8.start(0,1);
nombre_txt.text = "Teddybears -magic kraut";
album_txt.text = "Soft Machine";
fecha_txt.text = "2006";
lugar_txt.text = "Suecia";
cancion8.onSoundComplete = function() {
soundFinished = true;
cancion9 = new Sound();
cancion9.loadSound("canciones/The dandy warhols - primary.mp3",true);
cancion9.start(0,1);
nombre_txt.text = "The dandy warhols - primary";
album_txt.text = "Tributo a The Cure";
fecha_txt.text = "2006";
lugar_txt.text = "EEUU";
cancion9.onSoundComplete = function() {
cancion_1.start(0,1);
};
};
};
};
};
};
};
};
};

bastante rebuscado no??
pero bueno el tema es que hay varios botones con el nombre de cada canción(cancion1_btn, cancion2_btn etc....)
la idea es que al clicar en cada botón me envié a la canción correspondiente pero solo funciona el botón de la primera los otros 8 no responden!!
la ruta esta bien pero ya me he perdido, no entiendo porque no funcion, de seguro hay parte de mi carencia con este lenguaje pero hago lo que puedo!!
espero me puedan dar una mano!!
este es el enlace del reproductor

muchas gracias!!

Por ultravoz

6 de clabLevel



Genero:Masculino  

20/09/2005

firefox
Citar            
MensajeEscrito el 29 Dic 2008 10:59 pm
Lo primero: dale formato a tu código

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 29 Dic 2008 11:07 pm
Ante todo buenas tardes, veo que eres de argentina!!, si no me equivoco!
lo siento pero es mi primer post en cristalab, y al pegar el script quedo como quedo!!
no se como editar el mensaje!!
si no puedes darme una mano no pasa nada!!
saludos!

Por ultravoz

6 de clabLevel



Genero:Masculino  

20/09/2005

firefox
Citar            
MensajeEscrito el 29 Dic 2008 11:11 pm
espero que sea así!!

Código ActionScript :

stop_btn.onRelease = function() {
   stopAllSounds();
};
play_btn.onRelease = function() {
   cancion1.start(0,1);
};
cancion1_btn.onRelease = function() {
   cancion1.start(0,1);
};
cancion2_btn.onRelease = function() {
   cancion2.start(0,1);
};
cancion3_btn.onRelease = function() {
   cancion3.start(0,1);
};
cancion4_btn.onRelease = function() {
   cancion4.start(0,1);
};
cancion5_btn.onRelease = function() {
   cancion5.start(0,1);
};
cancion6_btn.onRelease = function() {
   cancion6.start(0,1);
};
cancion7_btn.onRelease = function() {
   cancion7.start(0,1);
};
cancion8_btn.onRelease = function() {
   cancion8.start(0,1);
};
cancion9_btn.onRelease = function() {
   cancion9.start(0,1);
};
cancion1 = new Sound();
cancion1.loadSound("canciones/Black devil disco club - with honey cream.mp3",true);
cancion1.start(0,1);
nombre_txt.text = "Black Devil Disco Club - With honey cream";
album_txt.text = "Eight on eight";
fecha_txt.text = "2007";
lugar_txt.text = "Paris";
soundFinished = true;
cancion1.onSoundComplete = function() {
   soundFinished = true;
   cancion2 = new Sound();
   cancion2.loadSound("canciones/Dzihan & Kamien Orchestra - After.mp3",true);
   cancion2.start(0,1);
   nombre_txt.text = "Dzihan & Kamien Orchestra - After";
   album_txt.text = "Live in Viena";
   fecha_txt.text = "2003";
   lugar_txt.text = "Alemania - Austria";
   cancion2.onSoundComplete = function() {
      soundFinished = true;
      cancion3 = new Sound();
      cancion3.loadSound("canciones/Ellen alien - Alles Sehen.mp3",true);
      cancion3.start(0,1);
      nombre_txt.text = "Ellen allien - Alles Sehen";
      album_txt.text = "";
      fecha_txt.text = "2003";
      lugar_txt.text = "Alemania";
      cancion3.onSoundComplete = function() {
         soundFinished = true;
         cancion4 = new Sound();
         cancion4.loadSound("canciones/Guy Gerber - Late Bloomers.mp3",true);
         cancion4.start(0,1);
         nombre_txt.text = "Guy Gerber - Late Bloomers";
         album_txt.text = "Belly Dancing";
         fecha_txt.text = "2007";
         lugar_txt.text = "Tel - Aviv";
         cancion4.onSoundComplete = function() {
            soundFinished = true;
            cancion5 = new Sound();
            cancion5.loadSound("canciones/Modeselektor - Ziq Zaq.mp3",true);
            cancion5.start(0,1);
            nombre_txt.text = "Modeselektor - Ziq Zaq";
            album_txt.text = "Hello mom!";
            fecha_txt.text = "2006";
            lugar_txt.text = "Berlin";
            cancion5.onSoundComplete = function() {
               cancion6 = new Sound();
               cancion6.loadSound("canciones/Shout out out out - Forever Indebted.mp3",true);
               cancion6.start(0,1);
               nombre_txt.text = "Shout out out out - Forever Indebted";
               album_txt.text = "Not saying just saying";
               fecha_txt.text = "2008";
               lugar_txt.text = "Canadá";
               cancion6.onSoundComplete = function() {
                  soundFinished = true;
                  cancion7 = new Sound();
                  cancion7.loadSound("canciones/Stereolab - Self Portrait with electric brain.mp3",true);
                  cancion7.start(0,1);
                  nombre_txt.text = "Stereolab - Self Portrait with electric brain";
                  album_txt.text = "Chemical Chords";
                  fecha_txt.text = "2008";
                  lugar_txt.text = "London";
                  cancion7.onSoundComplete = function() {
                     soundFinished = true;
                     cancion8 = new Sound();
                     cancion8.loadSound("canciones/Teddybears -magic kraut.mp3",true);
                     cancion8.start(0,1);
                     nombre_txt.text = "Teddybears -magic kraut";
                     album_txt.text = "Soft Machine";
                     fecha_txt.text = "2006";
                     lugar_txt.text = "Suecia";
                     cancion8.onSoundComplete = function() {
                        soundFinished = true;
                        cancion9 = new Sound();
                        cancion9.loadSound("canciones/The dandy warhols - primary.mp3",true);
                        cancion9.start(0,1);
                        nombre_txt.text = "The dandy warhols - primary";
                        album_txt.text = "Tributo a The Cure";
                        fecha_txt.text = "2006";
                        lugar_txt.text = "EEUU";
                        cancion9.onSoundComplete = function() {
                           cancion_1.start(0,1);
                        };
                     };
                  };
               };
            };
         };
      };
   };
};

Por ultravoz

6 de clabLevel



Genero:Masculino  

20/09/2005

firefox
Citar            
MensajeEscrito el 29 Dic 2008 11:18 pm
Uff, estás declarando la canción cuando termina la anterior, si le das a un botón antes de que ocurra eso el objeto Sound aún no existe. Con no mucho esfuerzo lo dejas en 10 líneas si haces lo siguiente (en orden de dificultar)

- Un array con todas las canciones
- un solo objeto sound que cargue la canción de ese array
- una variable que indique la posición actual (en que canción estás)
- un solo evento onSoundComplete que avance la variable de posición

En la sección tutoriales encontrarás un reproductor que funciona con un componente List que te puede ayudar con la idea

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 29 Dic 2008 11:32 pm
gracias por tu tiempo jorge!!
lo intentare pero soy un poco duro de cabeza!!
le echaré un vistazo!!
saludos

Por ultravoz

6 de clabLevel



Genero:Masculino  

20/09/2005

firefox
Citar            
MensajeEscrito el 29 Dic 2008 11:44 pm
mira!!
he visto como funciona , me aclaro un pococ con el array y el playlist en xml!!
pero el problema son los controles, no quiero usar el reproductor que viene por defecto en flash sino adaptarlo a mi reproductor,

Código ActionScript :

   //Propiedades del reproductor
   player.controllerPolicy = "on";
   player.mediaType = "MP3";
}

//Cuando cambiamos la canción seleccionada en la lista... cargamos la nueva canción, y ejecutamos
function alCambiar (evento){
   if (evento.type == "change"){
      player.setMedia("musica/"+lista.selectedItem.data, "MP3");
      player.play();
   }
};


está la explicacion pero no me entero de como ubicar los botones y la orden que se les tiene que dar, me explico??
buno !!
no se como explicarme, yo solo nesesito un play y un stop una funcion simple y que las canciones comience una cuando termina la otra y ya está!!
saludos!!

Por ultravoz

6 de clabLevel



Genero:Masculino  

20/09/2005

firefox
Citar            
MensajeEscrito el 30 Dic 2008 11:16 am
SI no quieres que el playlist sea visible lo ocultas, quita los controles que no necesites

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.