# Next Track/Previous Track

**URL:** https://forum.kirupa.com/t/next-track-previous-track/223577
**Category:** flash
**Created:** [April 24, 2007, 1:16am UTC](https://forum.kirupa.com/t/next-track-previous-track/223577 "2007-04-24T01:16:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![alemieux34](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@alemieux34](https://forum.kirupa.com/u/alemieux34)
#### Post date: [April 24, 2007, 1:16am UTC](https://forum.kirupa.com/t/next-track-previous-track/223577/1 "2007-04-24T01:16:18Z")

</div>

I’ve got a bunch of songs that I’m playing in a movie. All of the songs get created with the Sound Object first. I created an array to keep track of the songs. I want to use the array to trigger a next track and previous track button to go to the next or previous song in the array:

```auto
airplane = new Sound();
airplane.attachSound("airplane");
allthaticando = new Sound();
allthaticando.attachSound("allthaticando");
benearme = new Sound();
benearme.attachSound("benearme");
songs = new Array();
songs[0] = airplane;
songs[1] = allthaticando;
songs[2] = benearme;
nextSong = function () {
	for (i=0; i<songs.length-1; i++) {
		stopAllSounds();
		i++;
	}
};
prevSong = function () {
	stopAllSounds();
	songs*--;
	songs*.stop();
};
nextTrack.onRelease = function() {
	nextSong();
};
prevTrack.onRelease = function() {
	prevSong();
};

```

Any ideas?
