Solved

making a button to change the global volume

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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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 how to record live broadcast.
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.

757 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

19 Experts available now in Live!

Get 1:1 Help Now