Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flash Mute/unmute button 1

Status
Not open for further replies.

JohnnyxL

Programmer
Jul 25, 2007
12
US
Hello All, and thanks for all the help in previous posts.

I am making a flash mute/unmute movieclip (acts as button)
The button mutes sound, but dosn't toggle between states, i.e. when muted, it dosnt show 'unmute' in Frame 2


Instance name: Btn_Mute
The movie clip (muter) has two frames with the following labels:
Frame 1 is an image of a speaker with Off text:label:'muteoff'
actions in Frame 1 stop();
Frame 2 is an image of a speaker with On text:label:'muteon'
actions in Frame 2 stop();

In my main timeline I have the following actionscript:
bgSound = new Sound(this);
itquit = false;
itgoes = true;
bgSound.attachSound("sound1");
bgSound.start(0, 99);
slider.slideBar._x = -30;
function adjustVolume()
{
bgSound.setVolume(0 - 3.4 * this._x);
}
slider.slideBar.onEnterFrame = adjustVolume;
slider.slideBar.onPress = function()
{
slider.slideBar.onEnterFrame = adjustVolume;
startDrag(this, false, -30, 0, -3, 0);
};
slider.slideBar.onRelease = slider.slideBar.onReleaseOutside = function ()
{
stopDrag();
};
stop();
Btn_Mute.onPress = function()
{
if (bgSound.getVolume() != 0)
{
Btn_Mute.gotoandstop(muteoff);
oldVolume = bgSound.getVolume();
slider.slideBar.onEnterFrame = null;
bgSound.setVolume(0);


}
else
{
Btn_Mute.gotoandstop(muteon);
slider.slideBar.onEnterFrame = adjustVolume;
bgSound.setVolume(oldVolume);
}
};
///////////////////////


Thanks- JohnnyXL
 
I see your point of the frame label being in quoutes. Tried with frame numbers also. I still cant get the movieclip(button) to toggle between on/off states, even though it works at toggle sound on/off.

Again, thanks ken.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top