Skip to content

Instantly share code, notes, and snippets.

@douglasZwick
Created April 3, 2011 18:53
Show Gist options
  • Select an option

  • Save douglasZwick/900669 to your computer and use it in GitHub Desktop.

Select an option

Save douglasZwick/900669 to your computer and use it in GitHub Desktop.
Dan,
You can find the image files that my code calls for in http://dougzwick.com/digipen/resources/.
Specifically, you want
• http://dougzwick.com/digipen/resources/mute.png
• http://dougzwick.com/digipen/resources/muteover.png
• http://dougzwick.com/digipen/resources/mutedown.png
• http://dougzwick.com/digipen/resources/unmute.png
• http://dougzwick.com/digipen/resources/unmuteover.png
• http://dougzwick.com/digipen/resources/unmutedown.png
This is just in case you want to try to build a little project that works the way I want mine to.
Thanks for EVERYTHING (even the things for which you're obviously not responsible,
like the invention of the telescope and the weekend)!
Doug
div#toolbox
{
width: 112px;
height: 24px;
margin: 0 auto 0 auto;
padding: 0;
}
div#mutediv
{
width: 64px;
height: 24px;
margin: 0 auto 0 auto;
padding: 0;
}
<div class="toolbox">
<div id="mutediv" style="display: none">
<a href="#" onMouseOver="wrapp.onMouseOverMuteButton()"
onMouseOut="wrapp.onMouseOutMuteButton()"
onMouseDown="wrapp.onMouseDownMuteButton()"
onMouseUp="wrapp.onMouseUpMuteButton()">
<img id="mutebutton" src="resources/mute.png" alt="Mute Button" />
</a>
</div>
</div>
var WrApp = function()
{
var audioMuted = false; // ...among other variables
/* .
.
. */
// Earlier in the code....
document.getElementById("mutediv").style.display = "block";
/* .
.
. */
var onMouseOverMuteButton = function()
{
if (!audioMuted)
{
document.getElementById("mutebutton").src = "resources/muteover.png";
} else
{
document.getElementById("mutebutton").src = "resources/unmuteover.png";
}
}
var onMouseOutMuteButton = function()
{
if (!audioMuted)
{
document.getElementById("mutebutton").src = "resources/mute.png";
} else
{
document.getElementById("mutebutton").src = "resources/unmute.png";
}
}
var onMouseDownMuteButton = function()
{
if(!audioMuted)
{
document.getElementById("mutebutton").src = "resources/mutedown.png";
} else
{
document.getElementById("mutebutton").src = "resources/unmutedown.png";
}
}
var onMouseUpMuteButton = function()
{
introMusicAudio.toggleMute();
loopMusicAudio.toggleMute();
if(!audioMuted)
{
document.getElementById("mutebutton").src = "resources/unmute.png";
} else
{
document.getElementById("mutebutton").src = "resources/mute.png";
}
audioMuted = true;
}
} // End of WrApp function
window.onload = function()
{
var wrapp = new WrApp();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment