Jquery的Ajax加载swf文件

时间:2011-03-28 07:52:53

标签: jquery

有没有办法通过jQuery Ajax加载swf文件或者在页面加载完成后?

1 个答案:

答案 0 :(得分:3)

使用swfobject加载swf并随时调用它。

<小时/> 有关在jQuery.ajax回调中加载swf的完整示例将是

<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>