<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: How to Toggle Sound Globally (AS2)</title>
	<link>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally</link>
	<description>Luck is the residue of good design.</description>
	<pubDate>Fri, 12 Mar 2010 16:34:13 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: camron</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-429642</link>
		<pubDate>Thu, 10 Dec 2009 08:58:10 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-429642</guid>
					<description>Hi David, I have a project where i need to have a flv movie playing. Then be able to have users decide which audio they want to hear with the movie. Any ideas on how I could build my buttons to toggle back and forth between the 2 audio tracks? Thanks a million!</description>
		<content:encoded><![CDATA[<p>Hi David, I have a project where i need to have a flv movie playing. Then be able to have users decide which audio they want to hear with the movie. Any ideas on how I could build my buttons to toggle back and forth between the 2 audio tracks? Thanks a million!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: jes</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-387876</link>
		<pubDate>Fri, 01 May 2009 02:18:04 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-387876</guid>
					<description>hi, actionscripting is completely over my head.
I have a question: I have this script

import flash.media.Sound;
import flash.media.SoundChannel;

var soundOn:Boolean = true; //music is ON when we start
var myMusic:sakura = new sakura();
var myChannel:SoundChannel = myMusic.play(0,1000); // endless loop, in effect
var myTransform:SoundTransform;

sound.addEventListener(MouseEvent.CLICK,toggleSound);
sound.buttonMode = true;
sound.mouseChildren = false;


function toggleSound(e:MouseEvent)
{
	if(soundOn)
	{
		// turn sound off
		myTransform = new SoundTransform();
		myTransform.volume = 0; // silent
		myChannel.soundTransform = myTransform;
		soundOn = false;
		sound.myButtonText.text = &quot;sound&quot;;
	}
	else // sound is off
	{
		// turn sound on
		myTransform = new SoundTransform();
		myTransform.volume = 1; // full volume
		myChannel.soundTransform = myTransform;
		soundOn = true;
		sound.myButtonText.text = &quot;sound&quot;;
	}
}

to play a sound and to stop it as well, there is one frame I need to have the &quot;sakura&quot; song to not play at all (basically to stop that sound so another sound on the one movie clip could be heard clearly). How would I do that?</description>
		<content:encoded><![CDATA[<p>hi, actionscripting is completely over my head.<br />
I have a question: I have this script</p>
<p>import flash.media.Sound;<br />
import flash.media.SoundChannel;</p>
<p>var soundOn:Boolean = true; //music is ON when we start<br />
var myMusic:sakura = new sakura();<br />
var myChannel:SoundChannel = myMusic.play(0,1000); // endless loop, in effect<br />
var myTransform:SoundTransform;</p>
<p>sound.addEventListener(MouseEvent.CLICK,toggleSound);<br />
sound.buttonMode = true;<br />
sound.mouseChildren = false;</p>
<p>function toggleSound(e:MouseEvent)<br />
{<br />
	if(soundOn)<br />
	{<br />
		// turn sound off<br />
		myTransform = new SoundTransform();<br />
		myTransform.volume = 0; // silent<br />
		myChannel.soundTransform = myTransform;<br />
		soundOn = false;<br />
		sound.myButtonText.text = &#8220;sound&#8221;;<br />
	}<br />
	else // sound is off<br />
	{<br />
		// turn sound on<br />
		myTransform = new SoundTransform();<br />
		myTransform.volume = 1; // full volume<br />
		myChannel.soundTransform = myTransform;<br />
		soundOn = true;<br />
		sound.myButtonText.text = &#8220;sound&#8221;;<br />
	}<br />
}</p>
<p>to play a sound and to stop it as well, there is one frame I need to have the &#8220;sakura&#8221; song to not play at all (basically to stop that sound so another sound on the one movie clip could be heard clearly). How would I do that?
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Joe</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-385330</link>
		<pubDate>Thu, 23 Apr 2009 02:23:12 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-385330</guid>
					<description>Could you give me any tips on how to mute just some of the sounds on my page using as3? I have some buttons with sounds on the over frame (a rollover blip) which I would like to be able to silence without affecting the sound of other objects on the page.
 I tried using and adapting this from one of your earlier posts but can only succeed in muting everything. 
var xf:SoundTransform = SoundMixer.soundTransform;
xf.volume = 0;
SoundMixer.soundTransform = xf;
Thanks in advance!
Thanks</description>
		<content:encoded><![CDATA[<p>Could you give me any tips on how to mute just some of the sounds on my page using as3? I have some buttons with sounds on the over frame (a rollover blip) which I would like to be able to silence without affecting the sound of other objects on the page.<br />
 I tried using and adapting this from one of your earlier posts but can only succeed in muting everything.<br />
var xf:SoundTransform = SoundMixer.soundTransform;<br />
xf.volume = 0;<br />
SoundMixer.soundTransform = xf;<br />
Thanks in advance!<br />
Thanks
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-384079</link>
		<pubDate>Sun, 19 Apr 2009 16:21:18 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-384079</guid>
					<description>&lt;strong&gt;To all ...&lt;/strong&gt;
Most of these replies are coming very late.  Apologies!  It's been a busy couple years, mainly due to my recent work with friends of ED and O'Reilly.

&lt;strong&gt;To crittermonster ...&lt;/strong&gt;
&lt;blockquote&gt;My movie doesn't have a sound object. (I tried making one and it doesn't work either...but that's another story)&lt;/blockquote&gt;
You should still be okay, even without your other sounds being scripted.  The technique in this article simply sets the volume for the whole SWF to 100 or 0.  (Aside from this, I do encourage you to give scripted audio another shot!  Your best bet is to set aside the project you have in front of you and make exploratory steps in a new FLA file &amp;#8212; something that contains nothing at first but the minimum code required to get some audio playing.)
&lt;blockquote&gt;[...] so far, so good. But its capability to mute the movie's sound volume is totally nil.&lt;/blockquote&gt;
It's &lt;em&gt;possible&lt;/em&gt; that something about the way your timeline audio is set up is interfering with or overriding the ActionScript, but the first thing I'd check is whether or not your button's &lt;code&gt;onRelease&lt;/code&gt; handler is actually working.  For example, I would add a &lt;code&gt;trace()&lt;/code&gt; statement inside the function to see if I could shoot a quick confirmation message to the Output panel:
&lt;pre&gt;&lt;code&gt;btnMusic.onRelease = function() {
  globalVolume.setVolume(100 - globalVolume.getVolume());
  trace(&quot;yes, the button works&quot;);
}&lt;/code&gt;&lt;/pre&gt;
&lt;blockquote&gt;*Where* should I be putting that code? On the button itself or in the first frame of the movie?&lt;/blockquote&gt;
This code should be attached to a timeline keyframe &amp;#8212; &lt;em&gt;not&lt;/em&gt; to the button.  The keyframe should appear on the same frame number as the button itself.  For example, if the button appears in frame 1 of the main timeline, then that's also where the code should go.  If the button doesn't appear until frame 50, then &lt;em&gt;that's&lt;/em&gt; where the code should go.

&lt;strong&gt;To robin ...&lt;/strong&gt;
&lt;blockquote&gt;IS THIS CORRECT? The layer version works fine, but my buttons do not work the way you explained to Conan.&lt;/blockquote&gt;
The code I showed does work, but it all depends on where you put it (which also depends on how you arrange your assets &amp;#8212; buttons, and so on).  More on this in just a minute, because your more recent reply touches on it.  :)
&lt;blockquote&gt;AND WHAT HAPPENED TO THE PART: function():Void ? THIS DOES NOT SHOW UP IN THE BUTTONS CODE - AS IT DOES IN THE LAYER CODE VERSION.&lt;/blockquote&gt;
When you see suffixes that begin with a colon, such as &lt;code&gt;:Void&lt;/code&gt;, &lt;code&gt;:Number&lt;/code&gt;, &lt;code&gt;:Sound&lt;/code&gt;, and the like, you're seeing something called &lt;em&gt;strong typing&lt;/em&gt;, which is an optional (but recommended) practice in AS2 and AS3 (it's not supported in AS1).  By strongly typing your variables and functions, you let Flash know what &lt;em&gt;type&lt;/em&gt; of value you're intending to use, which helps with code hinting and compiler warnings/errors in AS2 and the same for AS3, plus improved runtime errors and even performance increases, due to more efficient usage of memory (RAM).
Some people choose not to strongly type their code, even in AS2 and AS3, and I'm sure some people don't realize they have the option (if, for example, they're handy with AS1).  When I refer to code samples from other people, I have to make the call whether or not to introduce elements like &lt;code&gt;:Void&lt;/code&gt;.  Sometimes, I worry that making an addition like that might throw someone off.  There are several articles on this blog, even with my own code, that omit strong typing.  In this case, all the &lt;code&gt;:Void&lt;/code&gt; means is that the function in question doesn't provide a return value.  That is, it simply &lt;em&gt;does&lt;/em&gt; something, but doesn't report back on that action.  Contrast that with, say, the native &lt;code&gt;Math.round()&lt;/code&gt; method, whith both &lt;em&gt;does&lt;/em&gt; something (rounds a number) and reports back (returns a number value).  For that reason, &lt;code&gt;Math.round()&lt;/code&gt; could be described like this:  &lt;code&gt;Math.round():Number&lt;/code&gt;.
&lt;blockquote&gt;I also have the problem, that the sound of a loaded swf (loaded onto an other level) should not start if the sound was silenced (setVolume(0)) before in the main swf.&lt;/blockquote&gt;
That does add a layer of complexity, for sure.  For that, you would have to get creative with your programming.  You could add ActionScript inside the loaded SWF that checks the volume of your main SWF's &lt;code&gt;globalVolume&lt;/code&gt; variable.  Alternatively, you could update the function that sets the global volume, rewriting it to account for external movie clips (SWFs).  (See my reply to Mike on March 17, 2008.)
&lt;blockquote&gt;I just found out by myself how the buttons do work ... One has to leave the WHOLE code as it is/was in the layer (not only putting: var globalVolume:Sound = new Sound(); there as explained to Conan). ADDITIONAL to that comes the button code part into the button, now it works fine!&lt;/blockquote&gt;
The most important part is that you find a solution that works.  Good!  :)  I'm curious what your final code structure was, because the code I suggested to Conan does work:  a &lt;code&gt;Sound&lt;/code&gt; instance is declared in the main timeline, and the buttons have access to that very instance by way of the variable named &lt;code&gt;globalVolume&lt;/code&gt; (or whatever you choose to name the instance).  You should be able to do a bit of testing using the &lt;code&gt;trace()&lt;/code&gt; function in your button code:
&lt;pre&gt;&lt;code&gt;on(release) {
  trace(globalVolume);
  globalVolume.setVolume(100);
}&lt;/code&gt;&lt;/pre&gt;
If you try something like that, for example, you should see something in the Output panel of the authoring tool.  If you see &quot;undefined,&quot; then your button's aren't &quot;seeing&quot; the &lt;code&gt;globalVolume&lt;/code&gt; instance, and that would explain why the code doesn't work as &lt;em&gt;currently arranged&lt;/em&gt;.  You might have to actually &lt;em&gt;target&lt;/em&gt; the path to &lt;code&gt;globalVolume&lt;/code&gt; with the &lt;code&gt;MovieClip._parent&lt;/code&gt; prefix &amp;#8212; once, or even a few times, depending on how deeply nested your buttons might be.

&lt;strong&gt;To martin and Neal ...&lt;/strong&gt;
Glad to hear it!  :)

&lt;strong&gt;To Roger ...&lt;/strong&gt;
&lt;blockquote&gt;My question is, can the button state selected be made to &quot;hang&quot; in the over state until another click on another button releases it and the new selection &quot;hangs&quot;?&lt;/blockquote&gt;
Yes, but to do that, you'll have to make your buttons out of movie clip symbols.  The reason for this is that buttons symbols have a very specialized timeline.  If you check out the AS2 &lt;code&gt;Button&lt;/code&gt; class &amp;#8212; in the Language Reference, not the Components Reference &amp;#8212; you'll find that buttons don't have anything like the &lt;code&gt;MovieClip&lt;/code&gt; class's &lt;code&gt;gotoAndPlay()&lt;/code&gt; or &lt;code&gt;gotoAndStop()&lt;/code&gt; methods.  If you want to stick with a particular the display state (aka a timeline frame), you'll have to actually program your buttons to do so, and that means you need &lt;code&gt;MovieClip&lt;/code&gt; methods.

&lt;strong&gt;To xTwIzZ ...&lt;/strong&gt;
You're welcome!  :)

&lt;strong&gt;To Joel ...&lt;/strong&gt;
&lt;blockquote&gt;I know this post is a little old, but I ran across it on a search and it was exactly what I needed! And what’s more, I learned some about how ActionScript works by figuring out how to implement it.&lt;/blockquote&gt;
I love to hear that!  Programming is tough if you don't know where to start &amp;#8212; and the same is true, of course, for any new endeavor, programming or not &amp;#8212; so I'm glad this gave you a leg up.</description>
		<content:encoded><![CDATA[<p><strong>To all &#8230;</strong><br />
Most of these replies are coming very late.  Apologies!  It&#8217;s been a busy couple years, mainly due to my recent work with friends of ED and O&#8217;Reilly.</p>
<p><strong>To crittermonster &#8230;</strong></p>
<blockquote><p>My movie doesn&#8217;t have a sound object. (I tried making one and it doesn&#8217;t work either&#8230;but that&#8217;s another story)</p></blockquote>
<p>You should still be okay, even without your other sounds being scripted.  The technique in this article simply sets the volume for the whole SWF to 100 or 0.  (Aside from this, I do encourage you to give scripted audio another shot!  Your best bet is to set aside the project you have in front of you and make exploratory steps in a new FLA file &mdash; something that contains nothing at first but the minimum code required to get some audio playing.)</p>
<blockquote><p>[&#8230;] so far, so good. But its capability to mute the movie&#8217;s sound volume is totally nil.</p></blockquote>
<p>It&#8217;s <em>possible</em> that something about the way your timeline audio is set up is interfering with or overriding the ActionScript, but the first thing I&#8217;d check is whether or not your button&#8217;s <code>onRelease</code> handler is actually working.  For example, I would add a <code>trace()</code> statement inside the function to see if I could shoot a quick confirmation message to the Output panel:</p>
<pre><code>btnMusic.onRelease = function() {
  globalVolume.setVolume(100 - globalVolume.getVolume());
  trace("yes, the button works");
}</code></pre>
<blockquote><p>*Where* should I be putting that code? On the button itself or in the first frame of the movie?</p></blockquote>
<p>This code should be attached to a timeline keyframe &mdash; <em>not</em> to the button.  The keyframe should appear on the same frame number as the button itself.  For example, if the button appears in frame 1 of the main timeline, then that&#8217;s also where the code should go.  If the button doesn&#8217;t appear until frame 50, then <em>that&#8217;s</em> where the code should go.</p>
<p><strong>To robin &#8230;</strong></p>
<blockquote><p>IS THIS CORRECT? The layer version works fine, but my buttons do not work the way you explained to Conan.</p></blockquote>
<p>The code I showed does work, but it all depends on where you put it (which also depends on how you arrange your assets &mdash; buttons, and so on).  More on this in just a minute, because your more recent reply touches on it.  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<blockquote><p>AND WHAT HAPPENED TO THE PART: function():Void ? THIS DOES NOT SHOW UP IN THE BUTTONS CODE - AS IT DOES IN THE LAYER CODE VERSION.</p></blockquote>
<p>When you see suffixes that begin with a colon, such as <code>:Void</code>, <code>:Number</code>, <code>:Sound</code>, and the like, you&#8217;re seeing something called <em>strong typing</em>, which is an optional (but recommended) practice in AS2 and AS3 (it&#8217;s not supported in AS1).  By strongly typing your variables and functions, you let Flash know what <em>type</em> of value you&#8217;re intending to use, which helps with code hinting and compiler warnings/errors in AS2 and the same for AS3, plus improved runtime errors and even performance increases, due to more efficient usage of memory (RAM).<br />
Some people choose not to strongly type their code, even in AS2 and AS3, and I&#8217;m sure some people don&#8217;t realize they have the option (if, for example, they&#8217;re handy with AS1).  When I refer to code samples from other people, I have to make the call whether or not to introduce elements like <code>:Void</code>.  Sometimes, I worry that making an addition like that might throw someone off.  There are several articles on this blog, even with my own code, that omit strong typing.  In this case, all the <code>:Void</code> means is that the function in question doesn&#8217;t provide a return value.  That is, it simply <em>does</em> something, but doesn&#8217;t report back on that action.  Contrast that with, say, the native <code>Math.round()</code> method, whith both <em>does</em> something (rounds a number) and reports back (returns a number value).  For that reason, <code>Math.round()</code> could be described like this:  <code>Math.round():Number</code>.</p>
<blockquote><p>I also have the problem, that the sound of a loaded swf (loaded onto an other level) should not start if the sound was silenced (setVolume(0)) before in the main swf.</p></blockquote>
<p>That does add a layer of complexity, for sure.  For that, you would have to get creative with your programming.  You could add ActionScript inside the loaded SWF that checks the volume of your main SWF&#8217;s <code>globalVolume</code> variable.  Alternatively, you could update the function that sets the global volume, rewriting it to account for external movie clips (SWFs).  (See my reply to Mike on March 17, 2008.)</p>
<blockquote><p>I just found out by myself how the buttons do work &#8230; One has to leave the WHOLE code as it is/was in the layer (not only putting: var globalVolume:Sound = new Sound(); there as explained to Conan). ADDITIONAL to that comes the button code part into the button, now it works fine!</p></blockquote>
<p>The most important part is that you find a solution that works.  Good!  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   I&#8217;m curious what your final code structure was, because the code I suggested to Conan does work:  a <code>Sound</code> instance is declared in the main timeline, and the buttons have access to that very instance by way of the variable named <code>globalVolume</code> (or whatever you choose to name the instance).  You should be able to do a bit of testing using the <code>trace()</code> function in your button code:</p>
<pre><code>on(release) {
  trace(globalVolume);
  globalVolume.setVolume(100);
}</code></pre>
<p>If you try something like that, for example, you should see something in the Output panel of the authoring tool.  If you see &#8220;undefined,&#8221; then your button&#8217;s aren&#8217;t &#8220;seeing&#8221; the <code>globalVolume</code> instance, and that would explain why the code doesn&#8217;t work as <em>currently arranged</em>.  You might have to actually <em>target</em> the path to <code>globalVolume</code> with the <code>MovieClip._parent</code> prefix &mdash; once, or even a few times, depending on how deeply nested your buttons might be.</p>
<p><strong>To martin and Neal &#8230;</strong><br />
Glad to hear it!  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>To Roger &#8230;</strong></p>
<blockquote><p>My question is, can the button state selected be made to &#8220;hang&#8221; in the over state until another click on another button releases it and the new selection &#8220;hangs&#8221;?</p></blockquote>
<p>Yes, but to do that, you&#8217;ll have to make your buttons out of movie clip symbols.  The reason for this is that buttons symbols have a very specialized timeline.  If you check out the AS2 <code>Button</code> class &mdash; in the Language Reference, not the Components Reference &mdash; you&#8217;ll find that buttons don&#8217;t have anything like the <code>MovieClip</code> class&#8217;s <code>gotoAndPlay()</code> or <code>gotoAndStop()</code> methods.  If you want to stick with a particular the display state (aka a timeline frame), you&#8217;ll have to actually program your buttons to do so, and that means you need <code>MovieClip</code> methods.</p>
<p><strong>To xTwIzZ &#8230;</strong><br />
You&#8217;re welcome!  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>To Joel &#8230;</strong></p>
<blockquote><p>I know this post is a little old, but I ran across it on a search and it was exactly what I needed! And what’s more, I learned some about how ActionScript works by figuring out how to implement it.</p></blockquote>
<p>I love to hear that!  Programming is tough if you don&#8217;t know where to start &mdash; and the same is true, of course, for any new endeavor, programming or not &mdash; so I&#8217;m glad this gave you a leg up.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Joel</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-383685</link>
		<pubDate>Fri, 17 Apr 2009 22:30:42 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-383685</guid>
					<description>I know this post is a little old, but I ran across it on a search and it was exactly what I needed! And what's more, I learned some about how ActionScript works by figuring out how to implement it. I'm just learning how to work with flash and AS for my job as webmaster (among other hats) at a small newspaper. This made my job a heap easier.  Thanks a ton!</description>
		<content:encoded><![CDATA[<p>I know this post is a little old, but I ran across it on a search and it was exactly what I needed! And what&#8217;s more, I learned some about how ActionScript works by figuring out how to implement it. I&#8217;m just learning how to work with flash and AS for my job as webmaster (among other hats) at a small newspaper. This made my job a heap easier.  Thanks a ton!
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: xTwIzZ</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-339792</link>
		<pubDate>Tue, 20 Jan 2009 23:46:13 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-339792</guid>
					<description>Hey, thanks this was very helpful</description>
		<content:encoded><![CDATA[<p>Hey, thanks this was very helpful
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Roger Stephenson</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-332819</link>
		<pubDate>Mon, 05 Jan 2009 18:05:47 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-332819</guid>
					<description>David, you da man!

I just started learning Flash, and for only 2 months in I feel pretty good about the whole affair, but I was having all sorts of issues with importing a video in swf mode, and not the flv version, and controlling the sound until I found this web site. Awesome. I put a small twist on your button call procedure and made 10 buttons and assigned a volume value for each like so:

var globalVolume:Sound = new Sound();
btnSoundOff.onRelease = function():Void {
 globalVolume.setVolume(0);
}
btnSound10.onRelease = function():Void {
 globalVolume.setVolume(10);
}
btnSound20.onRelease = function():Void {
 globalVolume.setVolume(20);
}
//and on and on for as many buttons as needed.........

This can be expanded to say 50 little buttons with 2% increases in sound value with an LED look, maybe with a little movie clip that glows on a fade up, and maybe shifting color tone as the scale increases. The current project I am working on has a few load external swf's and when time permits I am going to experiment with just this idea.

I think I like this method better than a slider.

My question is, can the button state selected be made to &quot;hang&quot; in the over state until another click on another button releases it and the new selection &quot;hangs&quot;?

Again, wonderful source for us all, newbie and pro!

Roger Stephjenson</description>
		<content:encoded><![CDATA[<p>David, you da man!</p>
<p>I just started learning Flash, and for only 2 months in I feel pretty good about the whole affair, but I was having all sorts of issues with importing a video in swf mode, and not the flv version, and controlling the sound until I found this web site. Awesome. I put a small twist on your button call procedure and made 10 buttons and assigned a volume value for each like so:</p>
<p>var globalVolume:Sound = new Sound();<br />
btnSoundOff.onRelease = function():Void {<br />
 globalVolume.setVolume(0);<br />
}<br />
btnSound10.onRelease = function():Void {<br />
 globalVolume.setVolume(10);<br />
}<br />
btnSound20.onRelease = function():Void {<br />
 globalVolume.setVolume(20);<br />
}<br />
//and on and on for as many buttons as needed&#8230;&#8230;&#8230;</p>
<p>This can be expanded to say 50 little buttons with 2% increases in sound value with an LED look, maybe with a little movie clip that glows on a fade up, and maybe shifting color tone as the scale increases. The current project I am working on has a few load external swf&#8217;s and when time permits I am going to experiment with just this idea.</p>
<p>I think I like this method better than a slider.</p>
<p>My question is, can the button state selected be made to &#8220;hang&#8221; in the over state until another click on another button releases it and the new selection &#8220;hangs&#8221;?</p>
<p>Again, wonderful source for us all, newbie and pro!</p>
<p>Roger Stephjenson
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Neal</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-311886</link>
		<pubDate>Tue, 02 Dec 2008 17:30:40 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-311886</guid>
					<description>You all are lifesavers.. thank you.</description>
		<content:encoded><![CDATA[<p>You all are lifesavers.. thank you.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: martin</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-310576</link>
		<pubDate>Mon, 01 Dec 2008 12:42:58 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-310576</guid>
					<description>thank you very much! this is just what i needed :)</description>
		<content:encoded><![CDATA[<p>thank you very much! this is just what i needed <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: robin</title>
		<link>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-295385</link>
		<pubDate>Wed, 05 Nov 2008 16:50:00 +0000</pubDate>
		<guid>http://www.quip.net/blog/2006/flash/how-to-toggle-sound-globally#comment-295385</guid>
					<description>God.......n!

I just found out by myself how the buttons do work ... One has to leave the WHOLE code as it is/was in the layer (not only putting: var globalVolume:Sound = new Sound();  there as explained to Conan). ADDITIONAL to that comes the button code part into the button, now it works fine!

But there is still my pre-detected sound problem of a loaded swf as mentioned above ...
When the sound has already been silenced on the main level, before loading a new swf (on a new level) with sound, this loaded swf should not start its sound now. The whole movie has to stay quite.

Robin</description>
		<content:encoded><![CDATA[<p>God&#8230;&#8230;.n!</p>
<p>I just found out by myself how the buttons do work &#8230; One has to leave the WHOLE code as it is/was in the layer (not only putting: var globalVolume:Sound = new Sound();  there as explained to Conan). ADDITIONAL to that comes the button code part into the button, now it works fine!</p>
<p>But there is still my pre-detected sound problem of a loaded swf as mentioned above &#8230;<br />
When the sound has already been silenced on the main level, before loading a new swf (on a new level) with sound, this loaded swf should not start its sound now. The whole movie has to stay quite.</p>
<p>Robin
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
