PDA

View Full Version : Creating a Flash Audio Player (need help)



byis
May 2nd, 2002, 12:29 AM
What im trying to do: well basically I want to create an audio player in flash. I would like for it to have buttons for next and previous track, pause, stop, play, and display song info.

Basically the one here at the bottom of the page:
www.basement-life.com (http://www.basement-life.com)


So what I got down at this point:

-Creating stop and play buttons that load/unload external swf files that contain the song.

-Show track info.

-Thats it :)


What I need help with:

-Creating next/previous track buttons so I can rotate between more than one song.

-Pause button.


If anyone could point me to good tuturial for doing such a thing a would really appreciate as I haven't ran across one yet.

byis
May 2nd, 2002, 12:50 AM
Ok someone posted some code on another forum but I cant get it working. For the pause button they suggested the following ActionScript:

on (release) {
_level2.stop();
}

That didn't seem to work.

Heres the ActionScript for my stop & play buttons:

-Play

on (release) {
loadMovieNum ("song1.swf", 1);
}


-Stop

on (release) {
unloadMovieNum (1);
}

upuaut8
May 2nd, 2002, 01:33 AM
A pause button is actually a little bit complex.. and I don't know how to do it, other than the principles involved. For what it's worth this is how it's done.

A pause button must judge how far into a song it is by having a counter which is triped when the song starts, then again when the pause button is pressed.

Then you use stopAllSounds(); to stop the music from playing.

Then when you hit pause again, it needs to start playing the song a number of milliseconds into it equal to the second counter minus the first counter.

As far as I know there is no other way of doing what you're talking about, UNLESS they've altered things in Flash MX.

suprabeener
May 2nd, 2002, 06:23 PM
that method will work just fine assuming song1.swf contains a sound set to streaming and enough frames as the sound is long.

but you're loading it into level1 and telling level2 to stop!

byis
May 2nd, 2002, 10:21 PM
Ya I changed it to level1 - and it does stop the song but it doesnt pause it.

suprabeener
May 3rd, 2002, 11:06 AM
sorry, no comprendo. stops but doesn't pause?

do you mean that _level1.play(); doesn't restart it?