我有一個Flex SWF託管在http://www.a.com/a.swf。 我有另一個doamin試圖加載SWF閃光代碼:如何使用Flash(AS3)從遠程域調用Flex SWF?
_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()
有沒有什麼辦法讓這段代碼工作?