Flash 和 Web 浏览器加载远程 swf 之间的差异
我正在开发一个项目,需要使用 flash 和 as2 将远程 swf 文件加载到另一个文件中。这应该很简单,但是远程 swf 文件在设计上是模块化的(即它需要调用以将其他 swf 文件加载到其中)
当我从 Web 浏览器输入远程 swf 文件的位置时,加载没有问题。
当我尝试使用 flash 加载 swf 文件时,出现与文件系统相关的错误。加载到我的闪存中的闪存似乎正在尝试加载其其他部分,并正在我的计算机上寻找它们。
请注意相对的 ../common/interface_engine.swf 参考
*** Security Sandbox Violation ***
Connection to ../common/interface_engine.swf halted - not permitted from http://www.remote-domain.com
-- Remote SWFs may not access local files.
为什么 Web 浏览器加载这样的 swf 不会出现任何问题?我不明白 Flash 使用的加载技术和 Web 浏览器使用的加载技术有什么区别。
我用来加载远程文件的代码
_root.createEmptyMovieClip("container", 1);
loadMovie(gamePath, "container");
I am working on a project where I need to load a remote swf file into another using flash and as2. This should be simple, but the remote swf file is modular by design (i.e it needs to make calls to load other swf files into it)
When I enter in the location to the remote swf file from a web browser it has no problem loading up.
When I try and load the swf file using flash I get errors relating to the file system. It seems the flash being loaded into my flash is trying to load its other pieces and is looking for them on my computer.
notice the relative ../common/interface_engine.swf reference
*** Security Sandbox Violation ***
Connection to ../common/interface_engine.swf halted - not permitted from http://www.remote-domain.com
-- Remote SWFs may not access local files.
How come a web browser does not have any issue loading swf's like this? I don't get the difference in loading techniques that flash uses and a web browser uses.
Code that I use to load remote file
_root.createEmptyMovieClip("container", 1);
loadMovie(gamePath, "container");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
出于安全原因,Flash 不允许本地运行的文件同时访问本地资源和远程资源。您可以选择其中之一。当您加载的 swf 引用“../common/blah”时,它是相对于加载位置的。
这是一篇关于 Flash 安全性更深入的文章:
For security reasons, Flash doesn't allow files running locally to have access to both local resources and remote resources. You can have one or the other. When the swf you're loading is referring to "../common/blah", it's relative to where it's being loaded.
Here's a much more in depth article about Flash security:
http://www.senocular.com/flash/tutorials/contentdomains/