?
Solved

Is it possible to control multiple sound channels through one variable?

Posted on 2008-10-11
1
Medium Priority
?
410 Views
Last Modified: 2013-11-11
is there any way to control mutliple sound channels through one sound channel.  this is what im thinking.  

soundchannel = soundchannel1, soundchannel1, soundchannel3
and then if turn the volume on soundchannel down, the other 3 sound channels volume will go down.

any ideas?
0
Comment
Question by:flashactions
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
ckoning earned 2000 total points
ID: 22694641
The way that you have written it, there is not. However, there is a conceptual workaround. I don't have working code, but the idea should work.

Use an array to store your sounds:

var scArr:Array = new Array();
scArr.push( sc1, sc2, sc3 );

Then use a function to adjust all the volumes at once using one SoundTransform:

function setVolume( vol:Number ):void
{   // Create the sound transform
    var st:SoundTransform =  new SoundTransform( vol, 0 ); // the second param is panning, see docs
    // Now set all the sound channels' transforms to the one created
    for each( var channel:SoundChannel in scArr )
    {   // Set the sound transform
        channel.transform = st;
    }
}

To adjust the combined volume, just call the function with a number in [0,1]. Similar techniques would work for stopping and playing the sounds.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question