Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Sound button - Mute / On/Off ?

  1. #1
    Join Date
    Dec 2008
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Sound button - Mute / On/Off ?

    Hi guys, I'm making a website in Flash and I'd like to put some music in the background, but I'd also like to include a button for the user to be able to disable/enable it as they please.

    However, just about every tutorial I've come across with sound buttons only STOPS the sound, and when the user clicks the play button, it starts from the beginning again.

    Is there a way I can make a button either mute or set the volume to 0, and then when clicked again have it restore it back to full without starting from the beginning again? Thanks!

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. The Following User Says Thank You to BLiZZaRD For This Useful Post:

    Iconoclast (12-06-2008)

  4. #3
    Join Date
    Dec 2008
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    Excellent, thanks mate!

    Also, another question while I'm at it...in my site I've got both sound effects (for button rollovers, clicks, etc.) and I want to put in like I said background music.

    All the sound effects sound fine, but when I drag an .mp3 I import to the library onto the keyframe I want it to start playing on, when I publish the site the music sounds really poor quality, as if its being played through a tube or something. I don't understand why, because when I test the settings of the file in the library (right click > properties > test) it sounds perfectly normal, as good as it does when I listen to it in iTunes.

    I've also tried changing the publish settings to up the bitrate to the maximum 160kpbs (my .mp3 file is encoded @ 192). I've also tried googling and looking up a lot of stuff on it but I haven't found anything...any ideas?

  5. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    MP3 files always start out at a certain "sampling rate-" a certain number of cycles per second. For our purposes it's good enough to know that high sampling rates sound great, and low sampling rates sound... not so great. But for speech and one-person acoustic performances, they can be just fine.

    The problem is that Flash Player only supports two sampling rates: 22,050 samples per second, and 44,100 samples per second.

    Here is a list of Flash supported bit-rates (you can ignore the rest)

    This PDF (for version 8) will show some settings to use when publishing. Give them a try.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  6. The Following User Says Thank You to BLiZZaRD For This Useful Post:

    Iconoclast (12-06-2008)

  7. #5
    Join Date
    Dec 2008
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    I'm giving the volume tutorial a try, but as I'm doing it it feels like I'm doing a lot of extra work for nothing...to be honest I'd rather have a mute button instead of a slidebar; not only would it take up less space but from what I can imagine it should be easier to do...do you know of any tutorials for that?

    PS - Thanks for the links, I'll look at those and see if I can fix my music sound.

  8. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  9. The Following User Says Thank You to BLiZZaRD For This Useful Post:

    Iconoclast (12-06-2008)

  10. #7
    Join Date
    Dec 2008
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    I've actually stumbled across that tutorial before in my search for a mute button, but it STOPS the sound when a user clicks it, and when unmuted, the sound starts over from the beginning =/

  11. #8
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    So, you want to basically pause the audio? Is that correct? If not, you might consider going about it that way. Muting the audio means that all of the resources that are used in that functionality remain in use -- not the best way to go.

  12. #9
    Join Date
    Dec 2008
    Posts
    24
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default

    If there is a SIMPLE way to PAUSE the audio without it RESTARTING when the user clicks play, then yes I would be very interested

  13. #10
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by Iconoclast View Post
    If there is a SIMPLE way to PAUSE the audio without it RESTARTING when the user clicks play, then yes I would be very interested
    lol, depends on your definition of simple. AS2 doesn't actually support pausing so you have to fake it. I think it's easy.

    Bascially, when someone clicks the pause button you:
    1) Stop the audio
    2) Get the position of the audio
    3) Save the position in a variable.

    Then, when someone enables the audio again, you refer to the position stored in the variable and begin playing the audio from that marker.

    If you're interested, Lee Brimelow goes over this technique in his video tutorials over at gotoAndLearn(). I'm not sure which tutorial it is. But, I remember him covering it in one some time ago.

Bookmarks

Posting Permissions

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