我有一个托管在http://www.a.com/a.swf的 Flex swf 。我在另一个尝试加载 SWF 的域上有一个 flash 代码:
_loader = new Loader();
var req:URLRequest = new URLRequest("http://services.nuconomy.com/n.swf");
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onLoaderFinish);
_loader.load(req);
在 onLoaderFinish 事件中,我尝试从远程 SWF 加载类并创建它们:
_loader.contentLoaderInfo.applicationDomain.getDefinition("someClassName") as Class
当此代码运行时,我得到以下异常
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()
有什么办法可以让这段代码工作吗?