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 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