Solved

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

Posted on 2008-10-11
1
406 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
1 Comment
 
LVL 4

Accepted Solution

by:
ckoning earned 500 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

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…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

813 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now