Copy link to clipboard
Copied
I made a list of mp3 songs using the list component in Flash CC, but they do not play.
¿Is there a function that I am missing? I thought I could make a playlist using the list component,
I used the following code... I'd appreciate the help.
MP3Playlist.addItem( { label: "Tatuaje.mp3" } );
MP3Playlist.addItem( { label: "08 Mi Ultimo Adios.mp3" } );
MP3Playlist.addItem( { label: "La Noche del Sabado.mp3" } );
MP3Playlist.addItem( { label: "Dime.mp3" } );
MP3Playlist.addItem( { label: "Regresaré.mp3" } );
MP3Playlist.addItem( { label: "Por Decision Unanime.mp3" } );
MP3Playlist.addItem( { label: "Promesas.mp3" } );
MP3Playlist.addItem( { label: "Maldito.mp3" } );
MP3Playlist.addItem( { label: "Confidente.mp3" } );
MP3Playlist.addItem( { label: "Olvidate de El.mp3" } );
MP3Playlist.addItem( { label: "180 UN POCO DE TIEMPO.mp3" } );
MP3Playlist.addItem( { label: "Caballito de Mar.mp3" } );
MP3Playlist.addItem( { label: "188 LA RECORDARE.mp3" } );
MP3Playlist.addItem( { label: "12 Tan Solo.mp3" } );
MP3Playlist.addItem( { label: "No Llores Mi Niña.mp3" } );
MP3Playlist.addItem( { label: "PIPIPARAOOOO.mp3" } );
MP3Playlist.addItem( { label: "05 me haces falta.mp3" } );
MP3Playlist.addItem( { label: "EL RECREO.mp3" } );
MP3Playlist.addEventListener(Event.CHANGE, songselected);
function songselected (event:Event):void{
}
Copy link to clipboard
Copied
All you have there is a list with some text labels in it. You need to, within songSelected, now play the selection. You can get the selection using selectedItem.label... or data if you use it which might be better:
function songselected (event:Event):void{
var selectedSong = MP3Playlist.selectedItem.label;
}
Copy link to clipboard
Copied
I pasted your code over my code, and they still don't play ... My goal is to makea playlist, and I thought I could make it with the list component
Copy link to clipboard
Copied
Right... as I mentioned all you have is a list component with TEXT labels. You need to now associate those labels with a Sound object. Something like so:
var mySound:Sound;
function songselected (event:Event):void{
var selectedSong = MP3Playlist.selectedItem.label;
switch(selectedSong){
case "Tatuaje.mp3":
mySound = new tatuaje(); //library sound
mySound.play();
break;
//etc///
}
}
Copy link to clipboard
Copied
I need to paste this code for each mp3, right?
Copy link to clipboard
Copied
Yes, you will need to reference each MP3 in order to play it.
Copy link to clipboard
Copied
im new at this, so, I don't know the structure ofhow to put all the code together....
¿where does this go?, ¿under my code or the middle? on top? etc
var mySound:Sound;
function songselected (event:Event):void{
var selectedSong = MP3Playlist.selectedItem.label;
switch(selectedSong){
case "Tatuaje.mp3":
mySound = new tatuaje(); //library sound
mySound.play();
break;
//etc///
}
}
Copy link to clipboard
Copied
Shouldn't matter as you're likely using timeline code on frames...Put everything in frame 1 and you should be fine. You may need to do a little reading on basic coding in Flash.
Copy link to clipboard
Copied
Yes I Do, I need to take a class on action script. Maybe next year around this time frame. I'm currently in a flash class now...
Copy link to clipboard
Copied
what do these errors mean... I posted the new code you gave me on a new layer on its first frame and I got these messages ....
Copy link to clipboard
Copied
Duplicate function means you have two functions with the same name... probably songSelected that you pasted in. Remove one of them... Not sure about the other ones. Look like component errors.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now