加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何使用带有swfobject的JavaScript加载swf?

发布时间:2020-12-15 19:47:11 所属栏目:百科 来源:网络整理
导读:我有以下swf: head # load js script function graph() { swfobject.embedSWF( "open-flash-chart.swf","chart","400","180","9.0.0","expressInstall.swf",{"data-file":"{% url monitor-graph %}"}); }; /script/headdiv id="chart" /divscriptgraph();/s
我有以下swf:

<head>
    # load js
    <script>
    function graph() {
     swfobject.embedSWF(
     "open-flash-chart.swf","chart","400","180","9.0.0","expressInstall.swf",{"data-file":"{% url monitor-graph %}"});
        };
    </script></head>

<div id="chart"> </div>
<script>
graph();
</script>

我想只在尚未加载swf的情况下才调用图形函数,有没有办法做到这一点?谢谢.

解决方法

embedSWF的最后一个参数是一个在嵌入swf时调用的回调函数.它接收一个事件对象,其中包含一些表示成功/失败的属性等.更多信息,请参见swfobject documentation.

swfobject.embedSWF(
 "open-flash-chart.swf",{"data-file":"{% url monitor-graph %}"},{},function(e) {
     if(e.success) graph();
   }
 );

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读