SWF 文件无法从服务器可靠加载
我使用 Adobe Flex 创建了一个应用程序。我从“bin-release”文件夹中取出了所有文件并将其放在服务器上。然后,当有人通过 http 连接到服务器时,它会被转发到“index.htm”。 “index.htm”页面是 Adobe Flex 在编译时自动创建的 HTML 页面,我只是将其重命名为该名称(如果重要的话,可以从 visco.html 重命名)。 SWF 文件保持不变。
问题是,大多数时候,当我访问服务器时,我会被转发到“index.htm”文件,并且它会完美加载 SWF。另外 30% 的时间,它不会加载!页面的背景变成蓝色(与我的 SWF 相同),如果我右键单击它,它会显示一个 Adobe Flash 下拉列表,因此看起来像是正在加载,但应用程序并未完全启动,即使它已 100%在调试期间和手动加载 SWF 文件时可靠。
我需要做什么才能使 SWF 文件可靠地加载和启动?
这是我嵌入 SWF 文件的位置:
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="visco" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="visco.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="visco.swf" quality="high" bgcolor="#869ca7"
width="100%" height="100%" name="visco" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
I have created an application using Adobe Flex. I took all the files from the 'bin-release' folder and put it on the server. Then when someone connected to the server through http it is forwarded to the "index.htm". The "index.htm" page is the HTML page created automagically by Adobe Flex during compile time, I just renamed it to that name (from visco.html if it matters). The SWF file remained the same.
The problem is that most of the time when I go to the server, I get forwarded to the "index.htm" file and it loads the SWF perfectly. The other 30% of the time, it doesnt load! The background of the page turns blue (same as my SWF) and if I right-click it, it shows an Adobe Flash dropdown, so it looks like its sort of loading, but the application doesnt fully start even though it has been 100% reliable during debugging and when loading the SWF file manually.
What do I need to do to get the SWF file to load and start reliably?
here is where I embed the SWF file:
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="visco" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="visco.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#869ca7" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="visco.swf" quality="high" bgcolor="#869ca7"
width="100%" height="100%" name="visco" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
事实证明,问题在于用于提供 SWF 文件的嵌入式板,而不是文件本身。
It turns out the problem was with the embedded board used to serve the SWF file, not the file itself.
听起来好像它在某处抛出异常并默默地失败(在 FP10.1 上滚动!!)。
将调试版本上传到服务器并尝试重新创建。它将为您提供比空白屏幕更多的信息。
请记住,如果您上传调试版本,则可以从 Flex Builder 远程调试(这始终是一个优点)。
如果它在生产中失败但在测试中失败,通常表明数据错误、硬编码 URL(本地主机是最大的罪魁祸首)或计时问题。
您的第一项工作是找出它失败的确切条件,为此您需要一个调试版本。
It sounds like it is throwing an exception somewhere and failing silently (roll on FP10.1!!).
Upload a debug version to the server and try and re-create. It will give you more information than a blank screen.
Remember that if you upload a debug version, you can debug remotely from Flex Builder (which is always a plus).
If it fails in production but not in testing, that usually suggests bad data, hardcoded URLs (localhost being the biggest culprit), or timing issues.
Your first job is to find what the exact conditions it's failing under, and for that you'll need a debug build.
尝试在浏览器中安装调试播放器,它应该会弹出堆栈跟踪对话框,如果应用程序像 gregor 建议的那样抛出异常,该对话框应该可以告诉您出了什么问题。发布版本上的其他调试方法是使用 firebug 网络监视器工具,该工具可以显示应用程序是否正在调用返回 404 的 url,并且应用程序可能未处理错误。但仅限于此。我能想到的其他一些想法是,在 oncomplete/initialize/preinitialize 事件中,您尝试访问空对象或属性,以便应用程序停在那里并阻止其加载。
try installing the debug player in your browser and it should popup the stack trace dialog that should give you a clue what's wrong if the app throws an exception like gregor suggested. other debugging methods on a release build is to use firebug network monitor tool which can show if the app is making a call to a url that returns 404 and maybe the app is not handling the error. but that's limited to this. some other ideas i can think of is that in your oncomplete/initialize/preinitialize event you are trying to access a null object or property so the app stops there and prevents it from loading.
问题实际上出在用于提供 SWF 文件的硬件上。用于访问 SD 卡(存储 SWF 的位置)的代码无法正常工作。
The problem was actually with the hardware used to serve up the SWF file. The code used to access the SD card (where the SWF was stored) wasn't working quite right.