安全域...尝试访问不兼容的上下文

发布于 2024-11-19 08:40:30 字数 2217 浏览 3 评论 0原文

我已经尝试了一天多的时间来让我的 Flex 应用程序从外部源加载 Flash 文件,但我不断收到以下错误。

我有一个带有通配符映射的跨域文件,并且使用 Security.allowDomain('*')。到底是怎么回事???

*** Security Sandbox Violation ***
SecurityDomain 'http://somedomain/en/interface.swf?sessionid=38D1E0B7-5356-42FC-B692-4E1EA019FD9A&gametype=64&affiliateid=1&currency=CHP&language=eng&freePlay=0' tried to access incompatible context 'file:///C:/_Projects/Casino_Old/FlashWrapperWorkspace/CasinoV2Loader/bin-debug/CasinoLoader.html'

我正在使用以下代码

<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&currency=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>

I have been trying for over a day now to get my flex application to load the flash file from an external source, but I keep getting the following error.

I have a crossdomain file with wildcard mapping and I use the Security.allowDomain('*'). What the heck is going on???

*** 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'

I'm using the following code

<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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文