Flash 安全域。。。试图访问不兼容的上下文
我已经尝试了一天多的时间来让我的flex应用程序从外部源加载flash文件,但我一直遇到以下错误 我有一个带有通配符映射的跨域文件,我使用Security.allowDomain('*')。到底发生了什么事Flash 安全域。。。试图访问不兼容的上下文,flash,apache-flex,security,mxml,Flash,Apache Flex,Security,Mxml,我已经尝试了一天多的时间来让我的flex应用程序从外部源加载flash文件,但我一直遇到以下错误 我有一个带有通配符映射的跨域文件,我使用Security.allowDomain('*')。到底发生了什么事 *** Security Sandbox Violation *** SecurityDomain 'http://somedomain/en/interface.swf?sessionid=38D1E0B7-5356-42FC-B692-4E1EA019FD9A&gametype=
*** Security Sandbox Violation ***
SecurityDomain 'http://somedomain/en/interface.swf?sessionid=38D1E0B7-5356-42FC-B692-4E1EA019FD9A&gametype=64&affiliateid=1¤cy=CHP&language=eng&freePlay=0' tried to access incompatible context 'file:///C:/_Projects/Casino_Old/FlashWrapperWorkspace/CasinoV2Loader/bin-debug/CasinoLoader.html'
我正在使用以下代码
Crossdomain.xml
显示跨域。使用SWFLoader,而不是loader。为什么不把SWFLoader放在MXML中呢。你的onComplete函数在哪里?似乎swf正试图以某种方式与您的主应用程序对话。添加了跨域和来自oncomplete的代码。我现在收到以下错误类型错误:错误#1034:类型强制失败:无法转换flash。显示::AVM1Movie@9838299到mx.core.IVisualElement。在CasinoLoader/onComplete()[C:_Projects\Casino\u Old\FlashWrapperWorkspace\CasinoV2Loader\src\CasinoLoader.mxml:41]我的swf是as3,我正在加载的是as2。请阅读您的。投票结束了,正在加载,不是吗?这是可能的。只是你正在加载的swf是旧的,而且编码很糟糕。对不起,我没有看到你在另一个上添加的额外注释。谢谢你的帮助。我希望我能给你加分什么的
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import flash.display.Loader;
import flash.display.Sprite;
import flash.events.Event;
import mx.controls.Alert;
import mx.controls.SWFLoader;
import spark.modules.ModuleLoader;
protected function initApp():void
{
var url:String = "http://somedomain/servlet/com.goblinstudios.lollipop.servlet.CasinoGatewayProxy3?sessionid=38D1E0B7-5356-42FC-B692-4E1EA019FD9A&gametype=64&affiliateid=1¤cy=CHP&language=eng&freePlay=0";
Security.allowInsecureDomain("*");
Security.allowDomain('*');
var sprite:Sprite = new Sprite();
var loader:Loader = new Loader();
sprite.addChild(loader);
var lc:LoaderContext = new LoaderContext(true);
lc.checkPolicyFile = true;
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
loader.load(new URLRequest(url), lc);
}
private function onComplete(e:Event):void {
addElement(e.target.loader.content);
}
]]>
</fx:Script>
Crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
<allow-http-request-headers-from domain="*" headers="SOAPAction"/>
</cross-domain-policy>