I have a Flex swf hosted at http://www.a.com/a.swf. I have a flash code on another doamin that tries loading the SWF:
_loader = new Loader(); var req:URLRequest = new URLRequest('http://services.nuconomy.com/n.swf'); _loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onLoaderFinish); _loader.load(req);
On the onLoaderFinish event I try to load classes from the remote SWF and create them:
_loader.contentLoaderInfo.applicationDomain.getDefinition('someClassName') as Class
When this code runs I get the following exception
SecurityError: Error #2119: Security sandbox violation: caller http://localhost.service:1234/flashTest/Main.swf cannot access LoaderInfo.applicationDomain owned by http://www.b.com/b.swf. at flash.display::LoaderInfo/get applicationDomain() at NuconomyLoader/onLoaderFinish()
Is there any way to get this code working?
This is all described in The Adobe Flex 3 Programming ActionScript 3 PDF on page 550 (Chapter 27: Flash Player Security / Cross-scripting):
It goes on in some more detail, with diagrams and all.