简体   繁体   English

在另一个AIR应用程序中加载Flash / Flex应用程序

[英]Loading Flash / Flex Applications in another AIR Application

i'm loading a Flex Application in my AIR App and i'm using the childSandboxBridge and parentSandboxBridge to communicate between those two. 我正在AIR应用程序中加载Flex应用程序,并且正在使用childSandboxBridgeparentSandboxBridge在两者之间进行通信。 Works like a charm. 奇迹般有效。

But i've tried to load a Flash Application (the main Class extends Sprite , not Application ) and therefore i get a SecurityError when trying to set the childSandboxBridge on the loaderInfo object. 但是我尝试加载Flash应用程序(主类扩展了Sprite ,而不是Application ),因此尝试在loaderInfo对象上设置childSandboxBridge时遇到安全childSandboxBridge

In the Flex app it's like this: I'm casting the loaderInfo since the childSandboxBridge Property is only available in AIR. 在Flex应用程序中,它是这样的:由于childSandboxBridge属性仅在AIR中可用,因此我正在投射loaderInfo。

loaderInfo = FlexGlobals.topLevelApplication.systemManager.loaderInfo;
try {
   Object(loaderInfo).childSandboxBridge = this;
} catch(e:Error) {
 ...
}

In my Flash app it's like this: 在我的Flash应用中,它是这样的:

loaderInfo = myMainObject.loaderInfo; // myMainObject is the same class as 'root'
try {
   Object(loaderInfo).childSandboxBridge = this;
} catch(e:Error) {
 ...
}

In the below example i get the following SecurityError: 在下面的示例中,我得到以下SecurityError:

Error #3206: Caller app:/airapp.swf/[[DYNAMIC]]/1 cannot set LoaderInfo property childSandboxBridge.

The SecuritySandbox for both examples is 'application'. 两个示例的SecuritySandbox均为“应用程序”。

Any ideas why it doesn't work with the Flash app? 有什么想法为什么不能与Flash应用程序一起使用? Thanks in advance. 提前致谢。

You may need to explicitly indicate in Flash code that you will allow it to be loaded into another VM. 您可能需要在Flash代码中明确指出要允许将其加载到另一个VM中。 Check out the flash.system.Security class documentation for details: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/system/Security.html 请查看flash.system.Security类文档以获取详细信息: http : //www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/system/Security.html

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

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