如何在基于 ModX 的网页中插入动态 SWF 文件?
我正在做一场真正的噩梦,试图完成本来应该非常简单的任务。 如果我嵌入静态或独立的 SWF 文件,它会在我们的 ModX 支持的网站上正常显示。 然而,当涉及到动态 SWF(引用 XML 文件和图像文件等的文件)时,我根本无法显示该内容。 根据我的 Flash 菜单程序,我将以下代码粘贴到页面的 HEAD 部分:(
<script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript" src="flying.js"></script>
当然,这些文件放置在根目录中),然后在 BODY 部分我应该粘贴以下内容:
<!-- Flash Menu Labs – www.flashmenulabs.com -->
<div id="FlashMenuLabs" style="position:absolute; top:0px; padding-left:0px; z-index:0;">
You need to upgrade your Flash Player or to allow javascript to enable Website menu. </br>
<a href="http://www.adobe.com/go/getflashplayer">Get Flash Player</a>
</div>
< script type="text/javascript">
// <![CDATA[
var so = new SWFObject("menu.swf", "menu", "185", "440", "8", "#000000");
so.addVariable("page _ code", "a _ b _ c");
so.addParam("wmode", "transparent");
so.addParam("scale", "noscale");
so.addParam("salign", "TL");
so.write("FlashMenuLabs");
// ]]>
</script>
这不起作用。 这些文件位于名为 icpmenu_es
的文件夹(flash
的子文件夹)中,这是引用 menu.swf
的位置。 相关文件(包括 XML、PNG 和 SWF)位于名为 menu_data
的子文件夹中。 有两个 XML 文件:open_menu_data.xml
和 menu_data.xml
,我无法编辑后者。
然后我在这里尝试了 路线:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="185" height="440"> <param name="base" value="http://www.ideal-country-property.com/"> <param name="movie" value="/flash/icpmenu_es/menu.swf"> <param name="id" value="ICPmenuES"> <param name="menu" value="false"> <param name="slalign" value="tl"> <param name="quality" value="high"> <param name="wmode" value="transparent"> <param name="scale" value="noscale"> <embed src="/flash/icpmenu_es/menu.swf" menu="false" quality="high" wmode="transparent" scale="noscale" width=185 height=440 type="application/x-shockwave-flash" id="ICPmenuES" salign="tl" base="http://www.ideal-country-property.com/" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"> </embed> </object>`
这也不起作用。 如果有人能帮助我指明正确的方向,那么我将不胜感激。 在其他论坛上,我看到人们提到编辑 SWF 中对 XML 的引用,但我不知道在哪里可以做到这一点。 作为一个新手程序员也没有多大帮助!
I'm having a real nightmare trying to do what should be a very simple task. If I embed a static or independent SWF file, it shows up fine on our ModX powered website. However, when it comes to a dynamic SWF (one that references an XML file and image files etc) I just can't get the thing to show up at all.
According to the Flash Menu program that I have I paste the following code in the HEAD part of the page:
<script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript" src="flying.js"></script>
(with those files placed in the root directory of course) and then in the BODY section I should paste this:
<!-- Flash Menu Labs – www.flashmenulabs.com -->
<div id="FlashMenuLabs" style="position:absolute; top:0px; padding-left:0px; z-index:0;">
You need to upgrade your Flash Player or to allow javascript to enable Website menu. </br>
<a href="http://www.adobe.com/go/getflashplayer">Get Flash Player</a>
</div>
< script type="text/javascript">
// <![CDATA[
var so = new SWFObject("menu.swf", "menu", "185", "440", "8", "#000000");
so.addVariable("page _ code", "a _ b _ c");
so.addParam("wmode", "transparent");
so.addParam("scale", "noscale");
so.addParam("salign", "TL");
so.write("FlashMenuLabs");
// ]]>
</script>
That doesn't work. The files are in a folder called icpmenu_es
(a subfolder of flash
), which is where the menu.swf
is referenced. The dependent files (including the XML, PNGs and SWFs) are in a subfolder called menu_data
. There are two XML files: open_menu_data.xml
and menu_data.xml
and I can't edit the latter.
Then I've tried the <EMBED>
route here:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="185" height="440"> <param name="base" value="http://www.ideal-country-property.com/"> <param name="movie" value="/flash/icpmenu_es/menu.swf"> <param name="id" value="ICPmenuES"> <param name="menu" value="false"> <param name="slalign" value="tl"> <param name="quality" value="high"> <param name="wmode" value="transparent"> <param name="scale" value="noscale"> <embed src="/flash/icpmenu_es/menu.swf" menu="false" quality="high" wmode="transparent" scale="noscale" width=185 height=440 type="application/x-shockwave-flash" id="ICPmenuES" salign="tl" base="http://www.ideal-country-property.com/" pluginspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"> </embed> </object>`
That doesn't work either. If anyone can help point me in the right direction then I would be most grateful. On other Forums I've seen people referring to editing the reference to the XML in the SWF, but I can't see where to do that. Being a newbie programmer doesn't help much either!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Flash 路径可能会变得非常棘手。
Flash 路径相对于调用 .swf 的 html,而不是相对于 .swf 所在的位置。
因此,如果您位于类似:
msite.com/news/article.html 的 .html 中,并且我使用“/anotherfolderinroot/test.swf”从此处调用 .swf,则 .swf 内的相对路径仍然是 misite.com/ news/
因此,加载 .swf 内没有绝对路径的电影或 xml,例如“data.xml”,flash 将查找 misite.com/news/data.xml
请注意使用包含在 .swf 中的域名的绝对路径。 html 调用(如“http://www.mydomain.com/media/mymovie.swf”)可能会触发 Flash 安全警告,并且在访问没有 www 的 url(如“http://misite.com/news”)时无法加载文件/article.html”尽可能避免这种情况。
希望能帮助到你。
Flash paths can get very tricky.
Flash paths are relative to the html where the .swf is called, not where .swf is located.
So, if you are in a .html like:
misite.com/news/article.html and i call a .swf from here using "/anotherfolderinroot/test.swf" your relative path inside the .swf is still misite.com/news/
so, loading a movie or xml without absolute paths inside the .swf, for example "data.xml" flash will be looking for misite.com/news/data.xml
Watch out using absolute path with domain names included in the .html call like "http://www.mydomain.com/media/mymovie.swf" that can trigger Flash Security warnings and not be able to load files when accesing the url without www like "http://misite.com/news/article.html" avoid this while you can.
Hope it helps.
您有权访问 Apache 日志吗?
我过去遇到过问题,如果 modx 对文件/文件夹权限不满意(例如,如果它们可以按组写入),那么它不会显示某些内容,只有 Apache 日志可以深入了解这一点。
Do you have access to the Apache logs?
I experienced problems in the past whereby if modx isn't happy with the file/folder permissions (if they are writable by group for example) then it won't show certain content and only the Apache logs give insight into this.