I am building an Air for Android (AS3) application that will load remote swf files (located on my server)
The idea is to keep the apk as stream lined as possible to allow fast deployment (will be deployed privately and not over Google Play)
- The apk is called the Loader
- The remote swf is called the Player.
Now, Player is throwing up this error when I launch Loader:
SecurityError: Error #2070: Security sandbox violation: caller http://sub.mydomain.com/remote/player.swf cannot access Stage owned by app:/Loader.swf.
This is odd as Player does not try to call the Loader stage - I told Player to make a new stage called "_stage", code below:
var playerContainer:MovieClip = new MovieClip();
var _stage:Stage = playerContainer.stage;
Using:
_stage.stageWidth
to access the stage width.
I have no idea why Loader thinks Player is trying to access it's stage properties?
I have tried the following pieces of code that I have seen mentioned in various forum posts, but nothing seems to alleviate the problem with the security domains:
In Loader
try {Security.allowDomain("*");}catch (e) { };
In Player
Security.allowDomain("http://sub.mydomain.com");
and also in Player, for my init() function
addEventListener(Event.ADDED_TO_STAGE, displayLogin);
Neither of these help.
I am at a total loss. It's above my head as to how to get Loader to allow Player access to its stage properties.
EDIT - when both swf files are on the server, and I access Loader via a browser, rather then using the android app, it loads fine. Definitely an issue with cross scripting, but it looks to me like I have all the right code to allow that?