Hi,
I’m trying to create a music bar that will have next/prev track buttons. Playing, pausing and stopping are no problem. How should I approach this?
I thought of creating an array of the tracks and navigating through the array.
or
Naming the tracks “track1”, “track2” etc, start with track1 and increase the number after every pass through the loop. Although I thought of these I could not get the code to work. If anybody can help me I would really appreciate it. Thank you.
well, actually, for this i think the most handy would be a “linked list”. a linked list is a collection of objects which all have a reference to the object before and after them. so you’d have an object for each track, and link them all to eachother. the reason this would be better than an array is that inserting/deleting elements from a linked list is very simple, a matter of changing one “previous” reference, and one “next” reference, while in an array it needs looping to move all the elements up/down to make room/delete a certain element.
Make a bunch of movieclips containing your sounds, name them sound1, sound2, etc, and on the first frame on each of those clips insert an empty keyframe and apply stop(); to it. Then, on the next (>>) button of your sound control, use something like this:
[AS]on (release){
_root.tracknumber += 1;
if (_root.tracknumber > totalamountoftracks){
_root.tracknumber = 1
}
_root.mcnumber = “sound”+_root.tracknumber;
stopAllSounds();
tellTarget(_root.mcnumber){
gotoAndPlay(2);
}
}[/AS]
The reason I’m using tellTarget here is that dot syntax didn’t work for me.
As for the previous button, apply this code:
[AS]on (release){
_root.tracknumber -= 1;
if (_root.tracknumber < totalamountoftracks){
_root.tracknumber = totalamountoftracks
}
_root.mcnumber = “sound”+_root.tracknumber;
stopAllSounds();
tellTarget(_root.mcnumber){
gotoAndPlay(2);
}
}[/AS]
This should work, if you do experience any problems you should make some code that explicitly tells the trackmc that isn’t working to stop and then restart, like this:
[AS]on (release){
_root.tracknumber -= 1;
if (_root.tracknumber < totalamountoftracks){
_root.tracknumber = totalamountoftracks
}
_root.mcnumber = “sound”+_root.tracknumber;
stopAllSounds();
tellTarget(_root.mcnumber){
gotoAndPlay(2);
}
if (_root.mcnumber == 1){
stopAllSounds();
_root.pathtomc.gotoAndStop(1);
_root.pathtomc.gotoAndPlay(2);
}
}[/AS]
In the above example, track nr 1 is the problem.
If you still experience any problems, don’t hesitate to ask 
ok I’ll try tonight and get back to you, thanks for the replies 