从javascript开始flash播放

时间:2013-02-21 17:55:42

标签: javascript flash

我的页面中嵌入了此Flash:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="180" height="76" id="SignUpTop1" align="middle">
<param name="movie" value="/Videos/SignUpTop1.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="false" />
<param name="loop" value="false" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="false" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="/Videos/SignUpTop1.swf" width="180" height="76">
    <param name="movie" value="/Videos/SignUpTop1.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#ffffff" />
    <param name="play" value="false" />
    <param name="loop" value="false" />
    <param name="wmode" value="window" />
    <param name="scale" value="showall" />
    <param name="menu" value="false" />
    <param name="devicefont" value="false" />
    <param name="salign" value="" />
    <param name="allowScriptAccess" value="sameDomain" />
<!--<![endif]-->
    <div style="height:180px">&nbsp;</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>

我想在加载页面5秒后开始播放Flash影片。所以,我这样做:

 setTimeout(function () {document.getElementById("SignUpTop1").play();}, 5000);

并且,在Chrome中收到此错误:

未捕获的TypeError:对象#没有方法'play'

从Javascript开始Flash播放的正确方法是什么?我们非常感谢代码示例。

谢谢

1 个答案:

答案 0 :(得分:1)

尝试使用,

setTimeout(function () {var movie=eval(window.document[\'SignUpTop1\']); movie.play();}, 5000);

setTimeout(function () {var movie=eval(document[\'SignUpTop1\']); movie.play();}, 5000);