Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9051099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:49:24+00:00 2026-06-16T12:49:24+00:00

I am using sound files from the library, not URLs. I am making a

  • 0

I am using sound files from the library, not URLs.

I am making a soundboard and have a button that plays background music. The reason I have a button instead of automatically playing on load is that there are a few different background musics to choose from, each with their own button.

I also have several other buttons that play sounds. I want the background music volume to lower to something like 0.3 while other sounds are playing. I believe I need to create a variable like soundCount that goes up when a sound plays, and decreases when the sound finishes playing (so that if there are multiple sounds playing at once, the background music won’t go back to normal until the count is at 0).

What’s the best way to set this up? I made the soundCount variable but I’m having trouble creating an event listener for when sound effect finishes playing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T12:49:25+00:00Added an answer on June 16, 2026 at 12:49 pm

    To change the volume of a sound in AS3, you need to use the SoundChannel and SoundTransform classes:

    var backgroundMusic:Sound = // Assuming you've loaded a sound
    
    var myChannel:SoundChannel = new SoundChannel();
    myChannel = backgroundMusic.play();
    
    var myTransform = new SoundTransform();
    myChannel.soundTransform = myTransform;
    

    Keep track of total sounds in the background by incrementing your count during calls to play and decrementing during SOUND_COMPLETE events. Add event listeners to other sounds’ channels so they can modify background‘s volume:

    var totalCurrentSounds:int = 0;
    
    otherSoundChannel.addEventListener(Event.SOUND_COMPLETE, otherSoundComplete);
    // Make sure this is on a SoundChannel, not the Sound itself.
    

    Finally, modify the SoundTransform‘s volume member when the count is 0:

    function otherSoundComplete(e:Event):void {
        totalCurrentSounds--;
        if (totalCurrentSounds <= 0) 
            myTransform.volume = 0.5;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making some project using SFML. I have downloaded library from their official
I have a website that collects audio recordings from visitors using Flash, I am
I'm using greensock LoaderMax to load video files and sound files. I've copied as
I am using multiple instances of AVAudioPlayer to play multiple sound files in a
I'm playing a prerecorded sound using a technique from an apple sample: // Set
I'm trying to stream sound from my soundcard using sox's default audio device and
I have a 3rd party library that's written in C. It exports all of
I'm using Core Audio / OpenAL to play CAF audio files. From Apple I
Possible Duplicate: Managing large binary files with git The situation is that I have
I have an application I've written in PHP from scratch. I'm using PHP's native

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.