开发者

jquery - swfobject loading mp3 onclick

So I'm using swfobject and I wrote a simple audio player in Flash, however I want to tell the player what mp3's to开发者_运维技巧 play when I click a link. So I figured I would do something like this,

$(document).ready(function(){
$('#run').click(function() {
        so.addVariable("audioURL", "track05.mp3");
   });
});

and I load the player like so...

    <div id="flashcontent"></div>

    <script type="text/javascript">
        // <![CDATA[
        var so = new SWFObject("musicplayer.swf", "sotester", "550px", "400px", "8", "#fff");
        so.addParam("scale", "noscale");
        so.write("flashcontent");
        // ]]>
    </script>


<a href="#" id="run">run</a>

So this type of thing does not work, is it something I'm doing wrong in flash or jquery? any help would be great thanks.


Flash, once embedded, cannot intercept new flashvar properties.

If you are looking to change the audio file via a JavaScript click, you'll want to look into ExternalInterface


There are swf media players with an API that allows one to change media on the fly via javascript, but not through changing the flashvar.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜