I was wondering if anybody knew how to create a music player complete with a Play button, Stop button, Next button ,Previous button and a small area containing the song name, similar to the one located at www.ChristinaMilian.com .
Printable View
I was wondering if anybody knew how to create a music player complete with a Play button, Stop button, Next button ,Previous button and a small area containing the song name, similar to the one located at www.ChristinaMilian.com .
u need to work with action script for that:
files= new array("file1.mp3","file2.mp3","file3.mp3")
now=0
vol=100
soundPlaying=new sound()
soundPlaying.attachSound(files[now])
now we r ready for the buttons:
play button:
stop:Code:on(press){
soundPlaying.play()
}
next:Code:on(press){
soundPlaying.stop()
}
Code:on(press){
soundPlaying.attachSound(files[(++now)%files.length])
soundPlaying.play()
}
back:
vol + button:Code:on(press){
now--;
if(now<0){
now=files.length
}
soundPlaying.attachSound(files[now])
soundPlaying.play()
}
vol - button:Code:on(press){
vol=vol+5
soundPlaying.setVolume(vol)
}
Code:on(press){
vol=vol-5
soundPlaying.setVolume(vol)
}
the first lines u need to put in the first frame
thanks for the help.. still a bit of trouble though because i'm not an advanced user.. but i'm guessing i have to replace some things with my filenames i'm just not sure where they go. could you help out a bit more please?
what u need to do is to put
in the first frame of the movie.Code:files= new array("file1.mp3","file2.mp3","file3.mp3")
now=0
vol=100
soundPlaying=new sound()
soundPlaying.attachSound(files[now])
in the first line u change the file1.mp3 etc.. to the file name u have let say hello.mp3.
then u add to every button the code that i wrote
hmmm... i did everything exactly the way you said it but it doesn't seem to be working when i test it. have you tried it to see if it works? and if so, could you please create it for me and send it to me so all i have to do is add my music into it?
it will be easyer if u send me yours, just the fla file
well when i save the file with my mp3s attached it becomes 133MB.. so do you want me to give you the .fla file without the mp3s attached?
like i wrote before, just the fla file
here it is
u forgot to tell me that u r working with mx.
now it's woking
ok now i have another problem... when i test the music player it gives me this message:
Error opening URL "file:///C|/Documents%20and%20Settings/Pierce%20Selman/Desktop/1.mp3"
now even though i replaced your 1.mp3 with my file it still came up as 1.mp3. but then when i hit the "next" button on the music player, it gives me this message:
Error opening URL "file:///C|/Documents%20and%20Settings/Pierce%20Selman/Desktop/blah blah.mp3"
"blah blah" representing the filename of my mp3. but the thing is, the mp3 that i specified isn't located on my desktop so i don't know why it's going there to locate it. can you help?
u need to put all the mp3 and the fla and the swf in the same directory for it to work
ok. it worked but when i test it i still get the error message saying it cannot find 1.mp3. do you know why it could be doing that? and if i wanted to put this on the web would i have to import the files to the library?
and is there any way of showing the artists and title of the song as they are being played?
also, when i add my 3 songs and test it and hit the "back" button, it gives me the following message:
Error opening URL "file:///C|/Documents%20and%20Settings/Pierce%20Selman/Desktop/"
do you know what could be causing that? and dont worry about helping me with the "Error opening URL "file:///C|/Documents%20and%20Settings/Pierce%20Selman/Desktop/1.mp3"" problem because i fixed it. and by the way i appreciate all of your help, thanks ALOT! :)
by the way, you have a very nice site... i just checked it out.. i dont understand one word on the site, but it's nice!!
10x about the site,
about the names, u should make an array to put all the names or u can change the names of your mp3 to be the names example:
"britny sprears - hoops i did it again.mp3"
and then take the name and show it.
about the import don't do that don't import nothing to the fla it's not the idea of the function.
about the back change it to this:
Code:on (press) {
_root.now--;
if (now<0) {
_root.now = files.length-1;
}
soundPlaying.stop()
soundPlaying.loadSound(files[now]);
soundPlaying.play();
}
wow it worked!! thats good! but i'm not exactly sure how to do the names thing. could you explain it please?
write in the first frame:
names= new array("britny spears - oops","u2 - one","bla - bla")
songName=names[now]
and make a box that get a varible: songName
that's it