Flash SWF 文件加载到 WebBrowser 控件时找不到 XML 数据文件(但在 IE9 中可以工作)

发布于 2024-12-06 04:43:52 字数 2432 浏览 3 评论 0原文

下面是一个长解释,希望有一个准确的简短问题摘要:

Can a .NET WebBrowser control (Win7 64-bit, IE9, current Flash 10.3.183.7) load a SWF file into an 标签,其中 SWF 文件位于一个单独的文件夹中,该文件夹还包含 XML 数据文件,以便让 SWF 文件加载并显示 XML 数据?

更新:根据一些进一步的实验,在下面添加了更多信息...

血淋淋的细节:

这困扰了我几天。请考虑以下内容:

C:\dev\wb.exe -- 使用 WebBrowser 显示磁盘中的本地 SWF 文件的程序

c:\data\mySWF.swf -- 我要播放的SWF文件 c:\data\myData.xml -- mySWF.swf 正在查找的包含数据的文件

C:\html\index.html -- wb 加载的 HTML 文件。EXE文件。该文件有一个标记来设置播放 c:\data\mySWF.swf 的 Flash ActiveX 控件。

最初,这是从使用 swfobject.js 开始的,当我没有看到我期望的结果时,我不断简化,直到我除了 HTML 之外什么都没有文件,没有额外的库。

如果我将 index.html 加载到 IE9 中,它就可以工作。我看到 SWF 文件正在播放加载的 XML 文件中的数据。

当我运行 wb.exe 时,它​​会加载 C:\html\index.html 文件,并且我会看到 SWF 正在播放。但数据字段为空。如果我将index.html复制到C:\data\index.html并将其加载到wb.exe中,那么我就会看到我的数据。

我的index.html 文件:

<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <style type="text/css">
* {
   width: 100%;
   height: 100%;
   margin: 0;
   padding: 0;
   overflow: hidden;
}
      </style>
</head>
    <body MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BOTTOMMARGIN="0"> 
        <object  type="application/x-shockwave-flash" width=100%" height="100%" id='player1' name='player1'> 
            <param name='movie' value='C:\data\mySWF.swf'>
            <param name='allowfullscreen' value='true'>
            <param name='allowscriptaccess' value='always'>
            <param name='base' value='C:\data\'>
            <param name='menu' value='false'>
            <param name='quality' value='best'>
            <param name='scale' value='exactfit'>
        </object>
    </body>
</html>

base 参数似乎是使其正常工作的一部分,但我对为什么(或是否)可以让 Flash ActiveX 控件按照我的方式工作感到困惑无需从与 SWF 文件相同的文件夹中加载 HTML 文件。

更新:如果我将 myData.xml 文件放入 C:\html 文件夹中,并从 C:\html\index.html 加载,我将获得 SWF 中的数据值。所以看来Flash插件正在使用index.html文件的路径,而不是基本参数。

更新:通过更多实验,我们发现,如果 SWF 文件使用 Action Script 2 (AS2) 进行 XML 处理(通过 XML.load()),则不会出现此问题,但使用 Action 的 SWF 文件则不会出现此问题。脚本 3 (AS3)(通过 URLLoader.load())无法正常工作。这只会变得更奇怪。

如果您坚持到现在,我感谢您的耐心,希望您能够指导我解决我的问题。

谢谢。

Bit of a long explanation below, with a hopefully accurate short question summary here:

Can a .NET WebBrowser control (Win7 64-bit, IE9, current Flash 10.3.183.7) load a SWF file into an <object> tag, where the SWF file is in a separate folder that also contains an XML data file in such a way as to have the SWF file load and display the XML data?

UPDATE: Added some more information below based on some further experimentation...

Gory detail:

This has plagued me for a couple of days. Consider the following:

C:\dev\wb.exe -- program that uses a WebBrowser to show a local SWF file from the disk

c:\data\mySWF.swf -- the SWF file I want to play
c:\data\myData.xml -- the file with data that mySWF.swf is looking for

C:\html\index.html -- HTML file loaded by wb.exe. This file has an <object> tag to set up a Flash ActiveX control playing c:\data\mySWF.swf.

Originally, this started with swfobject.js being used, and when I didn't see the results I was expecting, I kept simplifying until I got to the point where I don't have anything but an HTML file with no additional libraries.

If I load the index.html into IE9, it works. I see the SWF file playing with the data from the XML file loaded.

When I run wb.exe, it loads the C:\html\index.html file, and I see the SWF playing. But the data fields are empty. If I copy the index.html to C:\data\index.html and load it into wb.exe, THEN I see my data.

My index.html file:

<!DOCTYPE html>
<html>
    <head>
        <title></title>
        <style type="text/css">
* {
   width: 100%;
   height: 100%;
   margin: 0;
   padding: 0;
   overflow: hidden;
}
      </style>
</head>
    <body MARGINWIDTH="0" MARGINHEIGHT="0" LEFTMARGIN="0" RIGHTMARGIN="0" TOPMARGIN="0" BOTTOMMARGIN="0"> 
        <object  type="application/x-shockwave-flash" width=100%" height="100%" id='player1' name='player1'> 
            <param name='movie' value='C:\data\mySWF.swf'>
            <param name='allowfullscreen' value='true'>
            <param name='allowscriptaccess' value='always'>
            <param name='base' value='C:\data\'>
            <param name='menu' value='false'>
            <param name='quality' value='best'>
            <param name='scale' value='exactfit'>
        </object>
    </body>
</html>

The base parameter seemed to be part of getting this to work, but I'm stymied as to why (or whether) I can get the Flash ActiveX control to work the way I need it to, without having to load an HTML file from the same folder as the SWF file.

UPDATE: If I put the myData.xml file into the C:\html folder, and I load from C:\html\index.html, I get the data values in the SWF. So it seems that the Flash plug-in is using the path of the index.html file, and NOT the base parameter.

UPDATE: We've found out, through more experiementation, that this problem does NOT appear to occur if the SWF file uses Action Script 2 (AS2) for its XML handling (via XML.load()), but a SWF file using Action Script 3 (AS3) (via URLLoader.load()) does NOT work properly. This just gets weirder.

I appreciate your patience if you stuck around this far, and hopefully you might be able to educate me as to my problem.

Thanks.

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

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

发布评论

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

评论(1

放血 2024-12-13 04:43:52

作为我自己问题的后续,没有很好的解决方案。

我们通过使用 jQuery 调整主 HTML 中的 标签来解决此问题,以在每次加载时引用包含 SWF 和 XML 文件的文件夹新的 SWF 文件。这确实有效,但没有人真正对此感到满意。

我们与 Microsoft 进行了交谈,然后又与 Adob​​e 进行了交谈。 Adobe 将 .NET WebBrowser 控件中使用 Flash 称为“不受支持的用例”,并且不希望与此问题有更多关系。

As a follow-up to my own question, there's no nice solution.

We worked around the issue by using jQuery to adjust a <base href="">tag in the main HTML to refer to the folder with the SWF and XML file in, each time we loaded a new SWF file. That works, but no one's really happy with it.

We talked to Microsoft, and then to Adobe. Adobe calls the use of Flash in a .NET WebBrowser control an "unsupported use case" and doesn't want anything more to do with the issue.

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