使用外部 SWF 文件加载 SWF 时出现问题 - 使用 SWFObject 和ExternalInterface

发布于 2024-08-27 14:29:46 字数 1841 浏览 2 评论 0原文

我在加载引用外部 SWF 文件的 SWF 时遇到问题...

如果 HTML 文件与使用以下代码的所有 SWF 位于同一文件夹中,则主 SWF 加载正常:

<script type="text/javascript" src="../js/swfobject.js"></script>
<script type="text/javascript">
    var flashvars = {};
    var params = { allowScriptAccess: "always" };
    params.quality = "high";
    params.wmode = "transparent";
    var attributes = {id:"IDofSWF", name:"IDofSWF"};
    swfobject.embedSWF("event_so_js.swf", "flashContent", "700", "400", "7.0.0", false, flashvars, params, attributes);</script>
</head>

<body>

<div id="flashContent">    <object data="event_so_js.swf"
 name="IDofSWF" id="IDofSWF" type="application/x-shockwave-flash" 
width="700" height="400"></object></div>

但是一旦我将 HTML 文件移出将该文件夹复制到根文件夹并更新链接,它无法正确加载 - 似乎外部 SWF 文件出现问题。我确实成功地直接加载了外部 SWF 文件之一,但它在加载主 SWF 时遇到了问题。所有 SWF 文件都位于同一文件夹中,因此我不知道为什么会出现问题。以下是 HTML 文件位于根文件夹中时的代码:

<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
    var flashvars = {};
    var params = { allowScriptAccess: "always" };
    params.quality = "high";
    params.wmode = "transparent";
    var attributes = {id:"IDofSWF", name:"IDofSWF"};
    swfobject.embedSWF("folio/event_so_js.swf", "flashContent", "700", "400", "9.0.0", false, flashvars, params, attributes);</script>
</head>

<body>

<div id="flashContent">    <object data="folio/event_so_js.swf"
 name="IDofSWF" id="IDofSWF" type="application/x-shockwave-flash" 
width="700" height="400"></object></div>

页面上还有一个链接,该链接使用ExternalInterface 调用动作脚本中的函数,因此可能是导致问题的原因。链接的代码是:

<a href="#" onclick="document.getElementById('IDofSWF').clicky()">

任何帮助都会很棒,因为它真的让我感到困惑。

I'm having issues with loading a SWF that references external SWF files...

The main SWF loads fine if the HTML file is in the same folder as all the SWFs using the following code:

<script type="text/javascript" src="../js/swfobject.js"></script>
<script type="text/javascript">
    var flashvars = {};
    var params = { allowScriptAccess: "always" };
    params.quality = "high";
    params.wmode = "transparent";
    var attributes = {id:"IDofSWF", name:"IDofSWF"};
    swfobject.embedSWF("event_so_js.swf", "flashContent", "700", "400", "7.0.0", false, flashvars, params, attributes);</script>
</head>

<body>

<div id="flashContent">    <object data="event_so_js.swf"
 name="IDofSWF" id="IDofSWF" type="application/x-shockwave-flash" 
width="700" height="400"></object></div>

But as soon as I move the HTML file out of that folder to the root folder and update the links, it doesn't load correctly - it seems that it's having trouble with the external SWF files. I did have it successfully load one of the external SWF files directly, but it's having trouble with the main SWF. All of the SWF files are in the same folder, so I don't know why it's having issues. Here's the code for the HTML file when it's in the root folder:

<script type="text/javascript" src="js/swfobject.js"></script>
<script type="text/javascript">
    var flashvars = {};
    var params = { allowScriptAccess: "always" };
    params.quality = "high";
    params.wmode = "transparent";
    var attributes = {id:"IDofSWF", name:"IDofSWF"};
    swfobject.embedSWF("folio/event_so_js.swf", "flashContent", "700", "400", "9.0.0", false, flashvars, params, attributes);</script>
</head>

<body>

<div id="flashContent">    <object data="folio/event_so_js.swf"
 name="IDofSWF" id="IDofSWF" type="application/x-shockwave-flash" 
width="700" height="400"></object></div>

There is also a link on the page that calls a function in the actionscript using ExternalInterface, so it could be that causing the issues. The code for the link is:

<a href="#" onclick="document.getElementById('IDofSWF').clicky()">

Any help would be awesome, because it's really confusing me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

記柔刀 2024-09-03 14:29:47

整理出来...

我更新了所有的动作脚本路径,以便它们相对于 html/php 文件的位置,而不是主 swf。

Sorted it out...

I updated all the actionscript paths so that they were relative to the location of the html/php file, not the main swf.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文