Skip to main content
Known Participant
July 24, 2008
Question

mp3 buttons

  • July 24, 2008
  • 1 reply
  • 438 views
o.k so I've been trying to figure this out for a while now.
Almost every solution I look up involves some super complicated , long winded code...
I know there has got to be an easier way to do It.
This topic has been closed for replies.

1 reply

robdillon
Participating Frequently
July 24, 2008
Nope. It really does take a bunch of long winded code.
winfredhAuthor
Known Participant
July 25, 2008
How does it work?
robdillon
Participating Frequently
July 25, 2008
You haven't shown me the code that you're referring to, so its difficult to quess what you're looking at. I would do that operation like this:
1. create one button for each sound that I want to play.
2. create a sound channel object for each sound.
3. import each sound and attach it to a sound channel object.
4. set a variable to hold the value of the current sound, probably its sound object name.
5. set a property for each sound object to hold the position for that sound when it is stopped, if you want a pause feature.
6. attach a mouseUp event handler to each button.
7. have the mouseUp event handler, the function, tell a particular sound to play and the current sound to stop playing and, possibly, store the current position of the just stopped sound so that it will begin at that point when played again.
8. create a volume, and possibly, a pan, control to control the playback volume and pan of the sound.

Here's an example file that does all of this and more: http://schoolofflash.com/2008/03/22/flash-xml-music-player-in-actionscript-3/