开发者

Ajax Load swf File by Jquery

Is There a way to load swf file via jQuery Ajax Or aft开发者_Go百科er the page load complete?


Use swfobject to load the swf and call it whenever you like.


A full fledged example on loading the swf on an jQuery.ajax callback will be

<script type="text/javascript" src="https://www.google.com/jsapi?key=INSERT-YOUR-KEY">    </script>
<script type="text/javascript">
    google.load("jquery", "1.5.1");
    google.load("swfobject", "2.2");
</script>
<script type="text/javascript">
    $.ajax({
        url: "some url",
        context: document.body,
        success: function (msg) {
            LoadSWF();
        }
    });
    function LoadSWF(someData) {
        var flashvars = {
            name1: "hello",
            name2: "world",
            name3: "foobar"
        };
        var params = {
            menu: "false"
        };
        var attributes = {
            id: "myDynamicContent",
            name: "myDynamicContent"
        };

        swfobject.embedSWF("myContent.swf", "myContent", "300", "120", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
    }
</script>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜