Skip to main content
Inspiring
September 21, 2007
Question

Music player

  • September 21, 2007
  • 4 replies
  • 346 views
Hi all,

Newbie to this AS so seeking advice. I have seen a lot of tutorials on loadsound but none of them actually solve my issue.

What I am trying to achieve is to have a music player playing a list of mp3 songs randomly but hosted in another location/folder. this player will be located at the bottom of the site and is not in any frames. Additional condition is that the songs will not be interrupted by whatever the user clicks in the site unless of course user leaves the entire site.

theoretically, I thought of a few possibilities but I do not know how to go about doing it.

1) using a random formula to randomise the songs in the playlist like how it work for random quotes or random pics on the site,
2) putting the player in another swf link to the main swf so that whatever the user clicks on the main swf, they can go to different sections and yet would not be interrupting the songs.
3) can we achieve number 2) without using another swf? that is to place the music player in the main swf?

thanks alot for the advice in advance.
This topic has been closed for replies.

4 replies

Inspiring
October 14, 2007
ok. thanks again kglad.
kglad
Community Expert
Community Expert
October 14, 2007
you're welcome.
kglad
Community Expert
Community Expert
September 21, 2007
no. nothing will stop that sequence once it starts unless you use actionscript to stip it or you unload the swf from the flash player.
Inspiring
September 21, 2007
I see. thanks kglad.

so by doing what you mentioned above, would the song be interrupted if I
1) place the player in the main swf
2) user click on other sections of the swf.
kglad
Community Expert
Community Expert
September 21, 2007
1. create an array of your sound files.

2. shuffle() your array (check this forum for the shuffle() method of arrays.

3. create a sound instance

4. load your first sound file from the shuffled array.

5. on load complete start playing your sound and load the next sound in another sound instance. in fact, it would probably be easiest to create a new sound instance for each load. you can kill sound instances after play is complete.

6. on play complete, start the play of the 2nd sound instance if loading of it is complete. otherwise, wait until loading is complete and then start play.

7. etc