...

View Full Version : Question on Playing/Stopping MP3



genebalt
01-19-2008, 09:52 PM
Hi,

I would appreciate any help.

I have a Flash object which looks as follows:
http://img339.imageshack.us/img339/3015/screenshotxs1.jpg

Note the Speaker button and the 'X' button. Here's what I need to happen:

1) As soon as the movie is loaded, a specified MP3 should auto-start playing.
2) Clicking the 'Stop' button will stop the MP3 and save the current offset.
3) Clicking the 'Start' button will start at the current offset.

The offset isn't working and the auto-start I have no idea how to implement. I don't have a lot of Flash experience.

Here's what I have right now:

Action for the 'Speaker' button:


on(release)
{
SongOffset = 0;
var MP3ToPlay = new Sound();

startVolume=50;
offset = 0;
MP3ToPlay.onLoad = function(success:Boolean) {
if (success) {
MP3ToPlay.setVolume(startVolume);
MP3ToPlay.start(_root.SongOffset/1000);
}
}
MP3ToPlay.loadSound("sitemix.mp3", false);
}


Action for the 'Stop' button:


on(release)
{
_root.SongOffset = MP3ToPlay.position();
MP3ToPlay.stop();
}


The problem is that the offset isn't being saved. When I stop the MP3 and click the Speaker again, it starts from scratch. How can I make the offset global?

Also, how do I do auto-start? Thanks a lot.

PappaJohn
01-19-2008, 10:41 PM
IIRC, http://gotoandlearn.com has a tutorial that does just what you're looking for.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum