AS3 Android的AIR - 应用程序沙箱中的内容错误应用程序、错误、内容、Android

2023-09-08 14:06:07 作者:つ合ポ苽詠恆

目标:

我试图让外部加载的SWF文件相互在本地从设备加载通信。我需要能够有机会获得瓦尔和功能和对象。我已经accheived从这里的网络,而这个加载SWF内容:as3外部加载瑞士法郎从网络来控制从网络外部加载的SWF

I am trying to allow externally loaded swf files communicate with each other that are locally loaded from the device. I need to be able to have access to vars and functions and objects. I have accheived this while loading swf content from the web here: as3 externally loaded swf from network to control externally loaded swf from network

但是当我给了用户负荷设备或在线OPTION ...该设备的SWF文件不能互相通信。特别是加载的SWF不能从其父信息。

BUT WHEN I GIVE THE USER THE OPTION TO LOAD FROM DEVICE OR FROM ONLINE... The device swf files can't communicate with each other. Specifically the loaded swf can not get info from its parent.

下面是code,从网上加载时的作品:

Below is the code that works when loading from online:

var InsideConent:Object = this.parent.parent as Object; //// GIVES ACCESS TO "Content.swf"
var ItWorksNow:Sprite = MovieClip(InsideConent.TWO.content).ChildInTWO;  /// 

设备不喜欢这个code:

The device doesn't like this code:

Security.allowDomain("*");

但网上运行,当它工作正常。下面是我的错误,当我在本地运行的应用程序包加载。

But when run online it works fine. Below is the error I get when I run it locally loaded from the APP package.

以下错误:

引发SecurityError:错误#3207:应用程序沙箱中的内容无法访问该功能。     在flash.system通过::安全$ /的allowDomain()     在Products_fla :: MainTimeline /帧1() 在这个位置上不能显示源$ C ​​$ C。

SecurityError: Error #3207: Application-sandbox content cannot access this feature. at flash.system::Security$/allowDomain() at Products_fla::MainTimeline/frame1() Cannot display source code at this location.

的问题: 有什么我可以做,使允许安全域上针对Android设备的AIR本地工作,所以我没有改变我的code? - 谢谢

THE QUESTION: Is there anything I can do to make allow security domain to work locally on an AIR FOR ANDROID device so I don't have to change my code? - thanks

推荐答案

如果你把一个尝试捕捉周围行,如果它失败,将不会引发错误。而这样一来当你的code将工作网络和作为一个应用程序。 (应用程序不需要的allowDomain B / C,他们可以在默认情况下下载了一切,这就是为什么它会失败。)

If you put a try catch around that line it won't throw an error if it fails. And this way when your code will work on the web and as an app. (apps don't need to allowDomain b/c they can download everything by default and that is why it fails.)

{尝试的Security.allowDomain(*​​);}赶上(五){};