Solved

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
blocked plugin flash 5 107
Flash player updates using SCCM 2012 and SCUP 2011 3 361
bandwidth 5 64
Adobe Flash Player ActionScript error 6 50
Sometimes you know that one object has a specific child in it, but you can't find the child. This happened to me when I was trying to code some actionScript to make a toolbar work with its embedded buttons.  My partner had created the toolbar usi…
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 what frame rate is, how to control it and what effect it has on the video.

747 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

11 Experts available now in Live!

Get 1:1 Help Now