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. 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.
In the Flex app it's like this:
I'm casting the loaderInfo since the childSandboxBridge
Property is only available in AIR.
loaderInfo = FlexGlobals.topLevelApplication.systemManager.loaderInf开发者_开发问答o;
try {
Object(loaderInfo).childSandboxBridge = this;
} catch(e:Error) {
...
}
In my Flash app it's like this:
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:
Error #3206: Caller app:/airapp.swf/[[DYNAMIC]]/1 cannot set LoaderInfo property childSandboxBridge.
The SecuritySandbox for both examples is 'application'.
Any ideas why it doesn't work with the Flash app? Thanks in advance.
You may need to explicitly indicate in Flash code that you will allow it to be loaded into another VM. Check out the flash.system.Security class documentation for details: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/system/Security.html
精彩评论