Solved

making a button to change the global volume

Posted on 2007-11-19
4
563 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
  • 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I make renaming PARTS of MP3 tags simple? 8 44
Test movie names in Kodi / Openelec 6 101
Recording my desktop on a Mac 3 71
i am cortana ask me anything 5 51
Introduction This article is primarily concerned with ActionScript 3 and generally specific to AVM2.  Most suggestions would apply to ActionScript 2 as well, and I've noted those tips that differ between AS2 and AS3. With the advent of ActionS…
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…
Viewers will learn how to turn a Live Set into a compressed Live Pack file, and how to install Live Packs. Make: File > Collect All And Save: File > Manage Files: Click Manage Project: Click Create Pack: Select save location: Install: Doub…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

786 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