0

我正在尝试使用 SwfObject javascript 创建一个 flash 对象。它如何与 FF 和 chrome 一起工作,但它不显示背景颜色


我的 JS 代码

 var swfWidth = "500";
 var swfHeight = "500";
 var swfBgColor = "#ff0000";

 var flashVersion = '9.0.0'
 var flashvars = false;
 var params = { bgcolor:swfBgColor };
 var attributes = {};

 swfobject.embedSWF(swfUrl, "kcSwf", swfWidth, swfHeight, flashVersion, "/resources/expressInstall.swf", flashvars, attributes, params);

这是它在我的 IE 上为上述代码提供的输出。

它确实在标签上设置了bgcolor属性,但是它没有在标签中设置 bgcolor (见下文)

<OBJECT style="VISIBILITY: visible" id=kcSwf classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=620 height=540 bgcolor="F8F8F8"><PARAM NAME="_cx" VALUE="16404"><PARAM NAME="_cy" VALUE="14287"><PARAM NAME="FlashVars" VALUE="">
 <PARAM NAME="Movie" VALUE="http://test.skf.com/CampaignBanner/knowledgeengineering/090309_banners/flash_example.swf">
 <PARAM NAME="Src" VALUE="http://test.skf.com/CampaignBanner/knowledgeengineering/090309_banners/flash_example.swf">
 <PARAM NAME="WMode" VALUE="Window"><PARAM NAME="Play" VALUE="-1">
 <PARAM NAME="Loop" VALUE="-1">
 <PARAM NAME="Quality" VALUE="High"><PARAM NAME="SAlign" VALUE="">
 <PARAM NAME="Menu" VALUE="-1">
 <PARAM NAME="Base" VALUE=""><PARAM NAME="AllowScriptAccess" VALUE="">
 <PARAM NAME="Scale" VALUE="ShowAll">
 <PARAM NAME="DeviceFont" VALUE="0">
 <PARAM NAME="EmbedMovie" VALUE="0">
 <PARAM NAME="BGColor" VALUE="">           // <--- check this
 <PARAM NAME="SWRemote" VALUE="">
 <PARAM NAME="MovieData" VALUE="">
 <PARAM NAME="SeamlessTabbing" VALUE="1">
 <PARAM NAME="Profile" VALUE="0">
 <PARAM NAME="ProfileAddress" VALUE="">
 <PARAM NAME="ProfilePort" VALUE="0">
 <PARAM NAME="AllowNetworking" VALUE="all">
 <PARAM NAME="AllowFullScreen" VALUE="false">
 <PARAM NAME="AllowFullScreenInteractive" VALUE="">
</OBJECT>
4

1 回答 1

1

:) 我认为我的帖子很愚蠢,我自己回答问题:)

好吧,这是一个愚蠢的问题,但也许有一天它可能会对某些人有所帮助。我弄乱了属性和参数的顺序


错误的顺序

swfobject.embedSWF(swfUrl, "kcSwf", swfWidth, swfHeight, flashVersion, "/resources/expressInstall.swf", flashvars,属性, 参数);


正确的顺序

swfobject.embedSWF(swfUrl, "kcSwf", swfWidth, swfHeight, flashVersion, "/resources/expressInstall.swf", flashvars, params, attributes );

于 2012-08-15T12:17:35.030 回答