Solved

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

Posted on 2008-10-11
1
409 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 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
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 what frame rate is, how to control it and what effect it has on the video.

729 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