Making a playlist?

Subscribe to Making a playlist? 3 posts

avatar for tkrules tkrules 2 posts
Flag Post

How would I set up a code that allows me to select which song would play first and then second and then third? Lets say I have song X and song Y and song Z, how would I code it so that if the player clicked on button two then one then three then the songs would play Y X and then Z?

 
avatar for jasonjie88 jasonjie88 302 posts
Flag Post

Well, since you’ve got that blue D next to your name I will assume you know at least some basic coding. I will also assume you are coding in Actionscript 3.0, so if you aren’t ignore this thread.

1. Set up an array.
2. Add a mouse event (click) listener for each song on the list.
3. The event listener function should return a string/number which is pushed into an array. That array will be the order in which the songs are played.
4. When the song finishes, another function should be ready to determine what song should be played next.
5. Profit.

 
avatar for JamesObscura JamesObscura 250 posts
Flag Post

Linked List.

This is literally the exact use case they’re made for.