Skip to content

Instantly share code, notes, and snippets.

@boucher
Created October 3, 2008 23:13
Show Gist options
  • Select an option

  • Save boucher/14681 to your computer and use it in GitHub Desktop.

Select an option

Save boucher/14681 to your computer and use it in GitHub Desktop.
var setupSoundManager = function()
{
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "Resources/soundmanager2.js";
script.addEventListener("load", function()
{
window.x = soundManager;
soundManager.url = "Resources/"; // path to directory containing SoundManager2 .SWF file
soundManager.onload = function() {
soundManager.createSound("foo", "Resources/1hz-10khz-sweep.mp3");// etc. may now be called
soundManager.play("foo");
};
soundManager.beginDelayedInit();
}, YES);
document.getElementsByTagName("head")[0].appendChild(script);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment