javascript - Completely failing to grasp SoundManager's scope (with examples) -


apologies no fiddle; trying understand soundmanager 2's basics , failing miserably.

why doesn't work:

<script> soundmanager.setup({   url: 'swf/',   preferflash: false,   onready: function() {     // ready use; soundmanager.createsound() etc. can called.   } }); </script>  <script> $(document).ready(function() {   soundmanager.createsound({     id: 'mysound',     url: 'audio/sound.mp3',     autoload: true,     autoplay: true,     volume: 50   });   mysound.play(); }); </script> 

but does:

<script> soundmanager.setup({   url: 'swf/',   preferflash: false,   onready: function() {     soundmanager.createsound({       id: 'mysound',       url: 'audio/mysound.mp3',       autoload: true,       autoplay: true,       volume: 50     });     mysound.play();   } }); </script> 

i don't it... @ all. every sound have loaded onready()? , if so, how remotely useful 90% of use cases? have missing something. examples provide make seem easy putting anywhere in code:

soundmanager.createsound({  id: 'mysound2',  url: 'audio/mysound2.mp3' }); soundmanager.play('mysound2'); 

yet doesn't work. why?

from comments

the api properbly need thing on intialize , before ready run. if call createsound before api have finished loading there error. instead of using $(func..) starting point, try using onready, , call $(functio.. inthere

i have made non-working fiddle of mean: http://jsfiddle.net/ydc8j -- have not working soundmanager guessing


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -