我正在努力将我的闪存文件嵌入页面中,并尝试了以下两种方式的多种变体:
swf对象
<head>
<%= javascript_include_tag 'swfobject.js' %>
</head>
.
.
.
<div id="dragndrop">This requires Adobe Flash to view</div>
<script type="text/javascript">
var flashvars;
var params = {
movie: "<%= asset_path('flash/drag-n-drop-w-action3b.swf') %>",
background: "#FFFFFF",
quality: "high"
};
swfobject.embedSWF("<%= asset_path('flash/drag-n-drop-w-action3b.swf') %>",
"dragndrop", "100%", "100%", "6.0.0", false, params);
</script>
导航到该页面不会产生任何结果,但会在浏览器中输出以下内容:
<object id="dragndrop" width="100%" height="100%" type="application/x-shockwave-flash"
data="/assets/flash/drag-n-drop-w-action3b.swf" style="visibility: visible;">
<param name="flashvars" value="movie=/assets/flash/drag-n-drop-w-action3b.swf&background=#FFFFFF&quality=high">
</object>
我也试过没有参数,也无济于事。
我还尝试以多种方式手动添加它,包括此处所述。此 flash 文件当前已成功嵌入到不同的网站上,我什至将 html 复制粘贴到那里(修复了路径):
<object width="100%" height="100%" align=""
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param value="assets/flash/drag-n-drop-w-action3b.swf" name="movie">
<param value="high" name="quality">
<param value="#FFFFFF" name="bgcolor">
<embed width="100%" height="100%" align=""
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" bgcolor="#FFFFFF" quality="high"
src="/assets/flash/drag-n-drop-w-action3b.swf">
</object>
我究竟做错了什么?
编辑:
在 pipwerks 的帮助下,我将代码更改为:
var params = { background: "#FFFFFF",};
swfobject.embedSWF("<%= asset_path('flash/drag-n-drop-w-action3b.swf') %>", "dragndrop", "100%", "100%", "6.0.0", false, false, params);
但是,它仍然无法正常工作。输出的新 HTML 如下:
<object id="dragndrop" width="100%" height="100%" type="application/x-shockwave-flash"
data="/assets/flash/drag-n-drop-w-action3b.swf" style="visibility: visible;">
<param name="background" value="#FFFFFF">
</object>