Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2008-10-11
1
Medium Priority
?
412 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
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.

610 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