A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Controlling Multiple Sounds

  1. #1
    Member
    Join Date
    Oct 2001
    Posts
    50

    Controlling Multiple Sounds

    Hey everyone I'm having a problem with controlling 3 different sound. Just to let you know I'm an amature at this actionscripting stuff so I try to find things that are already done and I can figure out how to tweek it for my needs. Well I'm using the code below for each sound and it works great until I click a button to go to the next sound. If the sound is still going from the first one - the next one will overlap. I'm trying to make the sound stop when I click a forward or back arrow while the next sound plays. Any help would be much appreciated. Thanks.

    bgSound = new Sound(this);
    itquit = false;
    itgoes = true;
    bgSound.attachSound("audio1");
    bgSound.start();
    slider.slideBar._x = -30;
    function adjustVolume()
    {
    bgSound.setVolume(0 - 3.4 * this._x);
    }
    slider.slideBar.onEnterFrame = adjustVolume;
    slider.slideBar.onPress = function()
    {
    slider.slideBar.onEnterFrame = adjustVolume;
    startDrag(this, false, -30, 0, -3, 0);
    };
    slider.slideBar.onRelease = slider.slideBar.onReleaseOutside = function ()
    {
    stopDrag();
    };
    Btn_Mute.onPress = function()
    {
    if (bgSound.getVolume() != 0)
    {
    oldVolume = bgSound.getVolume();
    slider.slideBar.onEnterFrame = null;
    bgSound.setVolume(0);
    }
    else
    {
    slider.slideBar.onEnterFrame = adjustVolume;
    bgSound.setVolume(oldVolume);
    }
    };

  2. #2
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    -----
    If the sound is still going from the first one - the next one will overlap. I'm trying to make the sound stop when I click a forward or back arrow while the next sound plays.
    -----
    please only post the code relevant to your problem. Your code consists largely of volume control features which do not seem to be part of your problem. When you post code that is not relevant to the problem, people will wonder if you understand the code you are using, and consequently not understand their suggested code solution, and may not put forth the effort to help.

    Also it is frustrating for someone to read about a problem, such as forward back buttons, and not see any code related to forward or back.

    So, I would suggest that in the future, if you are hoping for people to help you, please consider that you need to provide relevant information in your post.

  3. #3
    Member
    Join Date
    Oct 2001
    Posts
    50
    Thanks for the input - I cleane up the code and I'll post a new thread with a .fla for people to see an example. Like I said before I'm an amature at actionscripting. Thanks.

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center