Solved

making a button to change the global volume

Posted on 2007-11-19
4
583 Views
Last Modified: 2008-02-07
Im making a cd rom with voice over prompts for stage elements. Id like the user to able to turn off the prompts if they so choose. Unfortunatly stopallsounds works for continuous audio so I think I need a solution that checks the current global volume and turns it to the oposite. ie, if the volume is on (100) the button then turns it to off (0) and vice versa. In this way the user can turn sound on and off.
Any help will be gratefully received.
0
Comment
Question by:sousflai
[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
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
DavidTMoore earned 500 total points
ID: 20316344
(note this is AS2, please let me know if you need AS3 code)

Put this in the first frame of the main timeline, this should create a global sound variable.

var globalSound:Sound = new Sound();
globalSound.setVolume(100);


then on your button click event handler use the following code.

if(_root.globalSound.getVolume() == 100)
{
      _root.globalSound.setVolume(0);      
}
else
{
      _root.globalSound.setVolume(100);
}


cheers
~David
0
 

Author Comment

by:sousflai
ID: 20324172
your a genius!
0
 
LVL 4

Expert Comment

by:DavidTMoore
ID: 20324508
glad to help.

cheers
~David
0
 

Author Comment

by:sousflai
ID: 20324522
I dont suppose you know how to get a button create an empty movie clip then import a jpg file from the library inside the clip. Also importing a button that will automatically remove the movie clip when pressed?
0

Featured Post

Technology Partners: 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

Suggested Solutions

Title # Comments Views Activity
mp4 file audio extraction 16 161
Help with audio only file for Youtube 17 77
Which programs could affect auto play 28 77
Free software 16 58
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 a Synology DS212+ NAS.  These are not only great for backup and normal NAS stuff, but also for delivering media throughout your home or LAN via DLNA.  I copied my whole audio collection from iTunes over to the box, but couldn't figure out how…
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.

737 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