Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question on Playing/Stopping MP3

    Hi,

    I would appreciate any help.

    I have a Flash object which looks as follows:


    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:
    Code:
    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:
    Code:
    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.

  • #2
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    IIRC, http://gotoandlearn.com has a tutorial that does just what you're looking for.
    John


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •