1

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&currency=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&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>
chobo
  • 31,561
  • 38
  • 123
  • 191
  • Show the crossdomain. Use SWFLoader, not loader. Why don't you just put SWFLoader in the MXML. Where's your onComplete function? It seems that the swf is trying to talk to your main app somehow. – J_A_X Jul 07 '11 at 20:17
  • Added crossdomain and added code from oncomplete. I am now getting the following error TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::AVM1Movie@9838299 to mx.core.IVisualElement. at CasinoLoader/onComplete()[C:\_Projects\Casino_Old\FlashWrapperWorkspace\CasinoV2Loader\src\CasinoLoader.mxml:41] My swf is an as3 the one I am loading is as2. – chobo Jul 07 '11 at 20:38
  • Read your [other question](http://stackoverflow.com/questions/6602584/why-isnt-the-swfloader-working). Voting to close. – J_A_X Jul 07 '11 at 20:40
  • 1
    It's loading isn't it? It's possible. Just that the swf you're loading is old and badly coded. – J_A_X Jul 07 '11 at 20:46
  • sorry, I didn't see the extra comment you added on the other one. Thank you for your help. I wish I could give you bonus points or something – chobo Jul 07 '11 at 20:47

0 Answers0