I am trying to implement SoundManager 2 to play snippets of songs on this page. This is my current JavaScript code:
alert( c! );
soundManager.url = http://www.transapine.ch/common/soundmanagerv297a-20120513/swf/soundmanager2.swf ;
soundManager.flashVersion = 8; // optional: shiny features (default = 8)
soundManager.useFlashBlock = false; // optionally, enable when you re ready to dive in
/*
Example HTML to make sound snippet:
<div>
<a href="http://path.to/soundclip/sclip.mp3" class="sclip hidden"><img src="..." height="x" /></a>
</div>
*/
alert( d! );
soundManager.onready(function() {
alert( e! );
var els = $.Elements.getElementsByClassName( sclip );
var a = url = ;
var clips = new Array();
var masterVolume = 100;
for (var i=0; i<els.length; i++) {
a = els[i];
url = a.href;
clips[i] = soundManager.createSound({
id: "clip" + i,
url: url,
volume: masterVolume
});//clips[i] = soundManager.createSound({
$.Events.add(a, "click", function(e) {
e.preventDefault();
clips[i].play();
});//$.Events.add(el, "click", function() {
$.CSS.removeClass(a, hidden );// show the button
}//for (var i=0; i<els.length; i++) {
});//soundManager.onready(function() {
而这是“超文本”网页中需要文字的部分:
<script src="http://assets.momo40k.ch/common/js/$-min.js" type="text/javascript"></script>
<script type="text/javascript">alert( a! ); //these alerts are for debugging</script>
<script src="http://assets.momo40k.ch/common/soundmanagerv297a-20120513/script/soundmanager2-nodebug-jsmin.js" type="text/javascript"></script>
<script type="text/javascript">alert( b! );</script>
<script src="http://assets.momo40k.ch/common/js/soundclips.js" type="text/javascript"></script>
<script type="text/javascript">alert( f! );</script>
<>说明: http://assets.momo40k.ch/common/js/%24.js”rel=“nofollow” 图书馆是一个小型图书馆,用于甚至消除浏览器差异。
我遇到了几个问题。
1. SWF files
In SoundManager s tutorial it says to use soundManager.url
to tell it the location of the SWF files it needs. Whatever value I gave it, it seemed to ignore it, as Firebug gave me the following error:
NetworkError: 404 Not Found - http://www.transalpine.ch/portale/soundmanager2.swf
So I tried putting soundmanager2.swf
in http://www.transalpine.ch/portale/
, and the error disappeared, so I continued to see if I could get it to work like this.
<>说明: 网址的本节中,我有一张打字基的标签:http://www.transalpine.ch/portale。
问题2和3同时发生,我只设法将其分开,将文字小打碎......
2. Script doesn t execute in certain conditions
After that, nothing happened. The two testing buttons I had put on the page weren t appearing as they should be ($.CSS.removeClass(a, hidden );
removes the class hidden
from the elements, effectively showing them), so I went about working out what was executing and what wasn t in my usual way: alerts!
So I found out that soundclips.js
wasn t executing at all, and then I found out that it could execute as long as lines 28-32 (clips[i] = soundManager.createSound({...});
) were commented out. That puzzled me: how can something the browser hasn t even read yet prevent from reading that whole file?!
3. soundManager.onready
doesn t fire
在拆除了这些线路后,我仍面临最后一个问题,尽管这可能是由问题1:活动<条码>声纳格.onready从未发生火灾。
Does anyone know what s wrong with my setup, and what s causing all these problems? I m guessing 2 and 3 both derive from 1, but I really don t understand 1 nor how 2 can be... Thank you!