简体   繁体   English

Adobe Air加载内部带有allowDomain('*')的外部swf

[英]Adobe Air loading external swf with allowDomain('*') inside

What i have 我有的

Large amount of swfs without it's sources (so i couldn't modify its) 没有其来源的大量瑞士法郎(因此我无法对其进行修改)

What i need 我需要的

To load and play this swfs with my AIR app. 使用我的AIR应用程序加载和播放此swfs。

The problem 问题

The problem is that this swfs seems having 问题是,这瑞士法郎似乎有

Security.allowDomain('*')

in their source, so they would throw 在他们的来源,所以他们会抛出

SecurityError: Error #3207: Application-sandbox content cannot access this feature. SecurityError:错误#3207:应用程序沙箱内容无法访问此功能。

after i load it. 我加载后。 I know that Air doesn't need to use this line, but instead of ignoring or warning on it my full app would stop to executing after loading one of this swfs. 我知道Air不需要使用此行,但是在加载其中一个swfs之后,我的完整应用将停止执行,而不是忽略它或对其发出警告。 If only i could try/catch this string, but as i said i don't have an source of that swfs, so the only thing i could do is to modify my AIR app. 如果只能尝试/捕获此字符串,但是正如我所说的那样,我没有该swfs的来源,那么我唯一能做的就是修改我的AIR应用程序。

What i tried 我尝试了什么

What i already tried is to catch all errors inside loader by doning 我已经尝试过的是通过做来捕获加载程序内部的所有错误

loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loaderIOErrorHandler);

private function loaderIOErrorHandler(e:IOErrorEvent):void {
    e.preventDefault();
}

but it seems it isn't catch errors inside loader at all 但似乎根本没有在加载程序中捕获错误

Update 更新

I couldn't share one of this swfs, but here is simulation i made that reproduce problem https://www.dropbox.com/s/0spbdzijfpboi47/problematicSwf.swf?dl=0 我无法共享其中一个瑞士法郎,但是这里是模拟,我重现了问题https://www.dropbox.com/s/0spbdzijfpboi47/problematicSwf.swf?dl=0

Here it's init code 这是初始化代码

private function init(e:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);

            Security.allowDomain('*');

            tf = new TextField();

            tf.text = 'Me loaded!';

            addChild(tf);
        }

As you could see it is crashing on allowDomain inside loaded swf. 如您所见,它在加载的swf中的allowDomain上崩溃。 And here is how i load it 这是我如何加载它

var ctx:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain);
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
loader.load(new URLRequest(path), ctx);

This is a typical security restriction but it's a very strict one and it's purpose is to make sure the served swf will never be used outside of what it was made for in the first place. 这是一个典型的安全限制,但它是一个非常严格的限制,目的是确保所提供的swf永远不会在最初使用的范围之外使用。

So the short answer to your problem is this: externally loaded swf that are sandboxed with "Security.allowDomain('*');" 因此,对您的问题的简短回答是:用“ Security.allowDomain('*');”沙盒加载的外部加载的swf will not allow a sandboxed AIR app to interact with them in anyway. 无论如何,将不允许沙盒AIR应用程序与它们进行交互。 Instead those swf will be able to interact with the parent AIR app under restrictions via a sandbox bridge. 相反,那些swf将能够在沙箱桥的限制下与父AIR应用程序进行交互。

If truly you cannot modify those swf then you will never be able to add them to a display list in a AIR app or call any of their methods. 如果确实不能修改这些swf,则将永远无法将它们添加到AIR应用程序的显示列表中或调用它们的任何方法。 A sandbox bridge will also be of no use to you. 沙盒桥也对您毫无用处。

It's not the answer you want to hear I bet but it's the only one you'll get. 这不是您想听到的答案,但这是您唯一会得到的答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM