trying to set custom ui mute button to mute by default
Setup:
Flash 8 Pro on Win2000
FLA setup:
I have an FLVplayback component on the stage with 5 buttons that change the contentPath of the component to load different videos.
I have a set of Custom UI (skinned) controls that are linked to the FLVplayback compenent to control it.
Problem:
I'm trying to mute the volume of the FLVplayback component when the movie loads, then when I select one of the buttons to load a new video it would turn the sound on again.
Solutions already tried:
I tried to set the myFLVplayback.volume = 0 on the first line so it would mute everything then when I selected the buttons it would set the volume to 100 again. Only problem is it sets it permenently and the mute button no longer works. Somehow it fights the functionality of the mute button component.
Code:
/////////////////////// Initialize variables ///////////////////////
//// _global.description changes when you click the corresponding buttons (buttons change the string)
_global.description = "Zoo Empire";
btn1Lit = true;
btn2Lit = false;
btn3Lit = false;
btn4Lit = false;
btn5Lit = false;
cvp.volume = 0;
//
///////////////////// Set Styles ///////////////////////////////
setInterval(changeText, 30);
function changeText() {
gameSelection.text = _global.description;
// Create a TextFormat object.
var txt_frmt:TextFormat = new TextFormat();
// Specify paragraph and character formatting.
txt_frmt.font = "Arial";
txt_frmt.bold = true;
txt_frmt.italic = false;
txt_frmt.size = 11;
gameSelection.setTextFormat(txt_frmt);
}
//
///////////////////////// Video Controls //////////////////////
var cvp:mx.video.FLVPlayback;
var cplaybtn:MovieClip;
cvp.playButton = cplaybtn;
cvp.pauseButton = cpausebtn;
cvp.stopButton = cstopbtn;
cvp.muteButton = cmutebtn;
cvp.seekBar = cseekbar;
cvp.autoRewind = false;
///
//////////////////// Play Game Button function /////////////////////
btnPlayGame.onRelease = function() {
if (description == "Zoo Empire") {
getURL("http://www.game1.com", "_blank");
} else if (description == "Korea Forgotten Conflict") {
getURL("http://www.game2.com", "_blank");
} else if (description == "Magic Ball 3") {
getURL("http://www.game3.com", "_blank");
} else if (description == "Pantheon") {
getURL("http://www.game4.com", "_blank");
} else if (description == "Bode Miller Alpine Skiing") {
getURL("http://www.game5.com", "_blank");
}
};
///////////////////// Zoo Empire button //////////////////////
//
mcFade1.onRollOver = function() {
mcFade1.gotoAndPlay("fadeIn");
};
mcFade1.onRollOut = function() {
mcFade1.gotoAndPlay("fadeOut");
};
mcFade1.onRelease = function() {
_global.description = "Zoo Empire";
btn1Lit = true;
btn2Lit = false;
btn3Lit = false;
btn4Lit = false;
btn5Lit = false;
};
//
////////////////////// Korea Button ///////////////////////////
//
mcFade2.onRollOver = function() {
mcFade2.gotoAndPlay("fadeIn");
};
mcFade2.onRollOut = function() {
mcFade2.gotoAndPlay("fadeOut");
};
mcFade2.onRelease = function() {
_global.description = "Korea Forgotten Conflict";
btn1Lit = false;
btn2Lit = true;
btn3Lit = false;
btn4Lit = false;
btn5Lit = false;
};
//
///////////////////////// Magic Ball Button ///////////////////////
//
mcFade3.onRollOver = function() {
mcFade3.gotoAndPlay("fadeIn");
};
mcFade3.onRollOut = function() {
mcFade3.gotoAndPlay("fadeOut");
};
mcFade3.onRelease = function() {
_global.description = "Magic Ball 3";
btn1Lit = false;
btn2Lit = false;
btn3Lit = true;
btn4Lit = false;
btn5Lit = false;
};
//
//////////////////////////// 10 tactswans //////////////////////////////
//
mcFade4.onRollOver = function() {
mcFade4.gotoAndPlay("fadeIn");
};
mcFade4.onRollOut = function() {
mcFade4.gotoAndPlay("fadeOut");
};
mcFade4.onRelease = function() {
_global.description = "Pantheon";
btn1Lit = false;
btn2Lit = false;
btn3Lit = false;
btn4Lit = true;
btn5Lit = false;
};
//////
////////////////////////////// Alpine Skiing Button /////////////////////////
//////
mcFade5.onRollOver = function() {
mcFade5.gotoAndPlay("fadeIn");
};
mcFade5.onRollOut = function() {
mcFade5.gotoAndPlay("fadeOut");
};
mcFade5.onRelease = function() {
_global.description = "Bode Miller Alpine Skiing";
btn1Lit = false;
btn2Lit = false;
btn3Lit = false;
btn4Lit = false;
btn5Lit = true;
};
////
/////////////////////////// Button Stay Lit function /////////////////////////
///
this.onEnterFrame = function() {
// switches the videos
if (btn1Lit == true) {
cvp.contentPath = "movies/nol_300kbps_50kf.flv";
mcFade1._visible = false;
mcFade2._visible = true;
mcFade3._visible = true;
mcFade4._visible = true;
mcFade5._visible = true;
} else if (btn2Lit == true) {
cvp.volume = 100;
cvp.contentPath = "movies/cellphone.flv";
mcFade1._visible = true;
mcFade2._visible = false;
mcFade3._visible = true;
mcFade4._visible = true;
mcFade5._visible = true;
} else if (btn3Lit == true) {
cvp.volume = 100;
cvp.contentPath = "movies/biorad_300kbps_50kf.flv";
mcFade1._visible = true;
mcFade2._visible = true;
mcFade3._visible = false;
mcFade4._visible = true;
mcFade5._visible = true;
} else if (btn4Lit == true) {
cvp.volume = 100;
cvp.contentPath = "movies/setidish_300kbps_50kf.flv";
mcFade1._visible = true;
mcFade2._visible = true;
mcFade3._visible = true;
mcFade4._visible = false;
mcFade5._visible = true;
} else if (btn5Lit == true) {
cvp.volume = 100;
cvp.contentPath = "movies/setifilter_300kbps_50kf.flv";
mcFade1._visible = true;
mcFade2._visible = true;
mcFade3._visible = true;
mcFade4._visible = true;
mcFade5._visible = false;
}
};
import mx.video.*;
var listenerObject:Object = new Object();
// listen for complete event; play new FLV
listenerObject.complete = function():Void {
if (cvp.contentPath == "movies/nol_300kbps_50kf.flv") {
cvp.play("movies/cellphone.flv");
} else if (cvp.contentPath == "movies/cellphone.flv") {
cvp.play("movies/biorad_300kbps_50kf.flv");
} else if (cvp.contentPath == "movies/biorad_300kbps_50kf.flv") {
cvp.play("movies/setidish_300kbps_50kf.flv");
} else if (cvp.contentPath == "movies/setidish_300kbps_50kf.flv") {
cvp.play("movies/setifilter_300kbps_50kf.flv");
} else if (cvp.contentPath == "movies/setifilter_300kbps_50kf.flv") {
cvp.play("movies/nol_300kbps_50kf.flv");
}
};
cvp.addEventListener("complete", listenerObject);
Thanks again for the help from anyone
|