friz2002
03-08-2004, 02:55 PM
Hi,
I have a volume slider that works ok and a mute button that works ok. But when I combine the two the mute button doesn't work properly anymore. The sound mutes (when there's volume), but doesn't "unmute" anymore.
I've uploaded an example + fla : http://uk.geocities.com/chris_vigier/volume.html
Can anyone tell me where I went wrong?
var drag:Boolean;
var muteVar:Boolean = false;
muteButtonPos = function () {
if (muteVar == false) {
_root.rack_mc.mute_mc.gotoAndStop("unmute");
} else {
_root.rack_mc.mute_mc.gotoAndStop("mute");
}
};
_root.rack_mc.v_slider_mc.v_rechthoek_mc.onPress = function() {
drag = true;
};
_root.rack_mc.v_slider_mc.v_rechthoek_mc.onRelease Outside = function() {
drag = false;
};
_root.rack_mc.v_slider_mc.v_rechthoek_mc.onRelease = function() {
drag = false;
};
_root.onEnterFrame = function() {
var sliderposition:Number = _root.rack_mc.v_slider_mc.v_rechthoek_mc._x;
if (drag) {
_root.rack_mc.v_slider_mc.v_rechthoek_mc._x = _root.rack_mc.v_slider_mc._xmouse;
if (_root.rack_mc.v_slider_mc.v_rechthoek_mc._x<=0) {
_root.rack_mc.v_slider_mc.v_rechthoek_mc._x = 0;
muteVar = true;
muteButtonPos();
}
if (_root.rack_mc.v_slider_mc.v_rechthoek_mc._x>=100) {
_root.rack_mc.v_slider_mc.v_rechthoek_mc._x = 100;
}
if (_root.rack_mc.v_slider_mc.v_rechthoek_mc._x>0 && _root.rack_mc.v_slider_mc.v_rechthoek_mc._x<100) {
muteVar = false;
muteButtonPos();
}
_root.globalvolume.setVolume(sliderposition);
}
_root.rack_mc.mute_mc.onRelease = function() {
if (_root.globalvolume.getVolume()>0 && muteVar == false) {
_root.globalvolume.setVolume(0);
muteVar = true;
muteButtonPos();
} else if (_root.globalvolume.getVolume()>0 && muteVar == true) {
_root.globalvolume.setVolume(sliderposition);
muteVar = false;
muteButtonPos();
}
if (_root.globalvolume.getVolume() == 0) {
muteVar = true;
muteButtonPos();
} else {
_root.globalvolume.setVolume(sliderposition);
muteVar = false;
muteButtonPos();
}
};
};
Thx
I have a volume slider that works ok and a mute button that works ok. But when I combine the two the mute button doesn't work properly anymore. The sound mutes (when there's volume), but doesn't "unmute" anymore.
I've uploaded an example + fla : http://uk.geocities.com/chris_vigier/volume.html
Can anyone tell me where I went wrong?
var drag:Boolean;
var muteVar:Boolean = false;
muteButtonPos = function () {
if (muteVar == false) {
_root.rack_mc.mute_mc.gotoAndStop("unmute");
} else {
_root.rack_mc.mute_mc.gotoAndStop("mute");
}
};
_root.rack_mc.v_slider_mc.v_rechthoek_mc.onPress = function() {
drag = true;
};
_root.rack_mc.v_slider_mc.v_rechthoek_mc.onRelease Outside = function() {
drag = false;
};
_root.rack_mc.v_slider_mc.v_rechthoek_mc.onRelease = function() {
drag = false;
};
_root.onEnterFrame = function() {
var sliderposition:Number = _root.rack_mc.v_slider_mc.v_rechthoek_mc._x;
if (drag) {
_root.rack_mc.v_slider_mc.v_rechthoek_mc._x = _root.rack_mc.v_slider_mc._xmouse;
if (_root.rack_mc.v_slider_mc.v_rechthoek_mc._x<=0) {
_root.rack_mc.v_slider_mc.v_rechthoek_mc._x = 0;
muteVar = true;
muteButtonPos();
}
if (_root.rack_mc.v_slider_mc.v_rechthoek_mc._x>=100) {
_root.rack_mc.v_slider_mc.v_rechthoek_mc._x = 100;
}
if (_root.rack_mc.v_slider_mc.v_rechthoek_mc._x>0 && _root.rack_mc.v_slider_mc.v_rechthoek_mc._x<100) {
muteVar = false;
muteButtonPos();
}
_root.globalvolume.setVolume(sliderposition);
}
_root.rack_mc.mute_mc.onRelease = function() {
if (_root.globalvolume.getVolume()>0 && muteVar == false) {
_root.globalvolume.setVolume(0);
muteVar = true;
muteButtonPos();
} else if (_root.globalvolume.getVolume()>0 && muteVar == true) {
_root.globalvolume.setVolume(sliderposition);
muteVar = false;
muteButtonPos();
}
if (_root.globalvolume.getVolume() == 0) {
muteVar = true;
muteButtonPos();
} else {
_root.globalvolume.setVolume(sliderposition);
muteVar = false;
muteButtonPos();
}
};
};
Thx