Ajax通过jQuery加载SWF文件 [英] Ajax Load swf File by Jquery

查看:161
本文介绍了Ajax通过jQuery加载SWF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过jQuery Ajax加载swf文件?还是在页面加载完成之后?

Is There a way to load swf file via jQuery Ajax Or after the page load complete?

推荐答案

使用 swfobject 加载swf并在需要时调用它.


jQuery.ajax 回调上加载swf的完整示例将是

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>

这篇关于Ajax通过jQuery加载SWF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆