7 Replies Latest reply on Aug 24, 2009 11:30 PM by _Natasha_

    How to resolve security sandbox violation (Error#2148) in Flex 3 on XP?

    sugu0925

      Hi,

       

      When I tried to access an image on c:\ (on XP), I get the following error:

       

       

      *** Security Sandbox Violation ***

      Connection to file:///C:\DBFiles\3.jpg halted - not permitted from http://localhost/test-debug/test.swf

      -- Remote SWFs may not access local files.

      SecurityError: Error #2148: SWF file http://localhost/ullmanphp-debug/ullmanphp.swf cannot access local resource file:///C:\DBFiles\INDSprintOrgChart.pptx\3.jpg. Only local-with-filesystem and trusted local SWF files may access local resources.

      at flash.display::Loader/_load()

      at flash.display::Loader/load()

       

      It looks like some sort of mismatch on security settings. I have done the following so far (based on what I got by googling....)

       

      1. Flex comipler setting additional compiler arguments:  -use-network=false

      2. I have added a crossdomain.xml on the source directory with these lines...

      <site-control permitted-cross-domain-policies="master-only"/>
      <allow-access-from domain="*"/>
      <allow-http-request-headers-from domain="*" headers="SOAPAction"/>

       

      However, error is still appearing. How do I fix this for testing on my local machine. I cannot move to a webserver at this time.

       

      Thanks!.

        • 1. Re: How to resolve security sandbox violation (Error#2148) in Flex 3 on XP?
          _gilado

          run your test.swf off of the local storage. Instead of http://localhost/ullmanphp-debug/ullmanphp.swf  use file:///<webserverdir>/ullmanphp-debug/ullmanphp.swf

          1 person found this helpful
          • 2. Re: How to resolve security sandbox violation (Error#2148) in Flex 3 on XP?
            sugu0925 Level 1

            I run it from flex builder with debug enabled. How do I run swf off local server path from within flex builder?

            • 3. Re: How to resolve security sandbox violation (Error#2148) in Flex 3 on XP?
              sugu0925 Level 1

              How do I set Security.sandboxType related to flash player? When I try to see it in my application through debugger it says "remote". I think I need to set it to one of the following from the adobe manual pages...

               

              Security.sandboxType has one of the following values:

              • remote (Security.REMOTE)—This file is from an Internet URL and operates under domain-based sandbox rules.
              • localWithFile (Security.LOCAL_WITH_FILE)—This file is a local file, has not been trusted by the user, and it is not a SWF file that was published with a networking designation. The file may read from local data sources but may not communicate with the Internet.
              • localWithNetwork (Security.LOCAL_WITH_NETWORK)—This SWF file is a local file, has not been trusted by the user, and was published with a networking designation. The SWF file can communicate with the Internet but cannot read from local data sources.
              • localTrusted (Security.LOCAL_TRUSTED)—This file is a local file and has been trusted by the user, using either the Flash Player Settings Manager or a FlashPlayerTrust configuration file. The file can read from local data sources and communicate with the Internet.
              • application (Security.APPLICATION)—This file is running in an AIR application, and it was installed with the package (AIR file) for that application. By default, files in the AIR application sandbox can cross-script any file from any domain (although files outside the AIR application sandbox may not be permitted to cross-script the AIR file). By default, files in the AIR application sandbox can load content and data from any domain.

              Any input on how to set it would be greatly appreciated. Thanks!

              • 4. Re: How to resolve security sandbox violation (Error#2148) in Flex 3 on XP?
                _Albertx_

                You're right.

                You need to change the security sandbox type of your swf generated by Flex.

                 

                Just do the next:

                - Open the Project Properties ( Right click on the main project folder and then "Properties")

                - Go to "flex compiler" section in the left side.

                - Type the following in the "Additional compiler arguments" field. (   -use-network=false    )

                 

                Then just recompile the application and now your swf will be in a local-with-file system sandbox.

                • 5. Re: How to resolve security sandbox violation (Error#2148) in Flex 3 on XP?
                  sugu0925 Level 1

                  I followed your instructions. It still comes up with "remote" as the security type. If I run the swf file directly as suggested by gilado, it does run properly. However, I lose the benefit og the debugger in that case. Any thoughts on how I can get the security level changed to support local file access (i did use the settings manager to point to the directories from where I try and read .jpg files, .swf files etc.). Thanks!

                  • 6. Re: How to resolve security sandbox violation (Error#2148) in Flex 3 on XP?
                    _Albertx_ Level 1

                    You use the Global Security Settings Manager to point to the directory where your swf is ??? That should've worked too. When you do that you set your swf to a local-trusted sandbox and that swf should be able to load the assets. I think maybe the path can be wrong. Try making all your computer drive appear in the Settings Manager (temporaly) and try to re-launch your swf. Just to make sure that can also load the assets. If it works then the exact path is wrong.

                    • 7. Re: How to resolve security sandbox violation (Error#2148) in Flex 3 on XP?
                      _Natasha_ Level 4

                      To call debugger from server:

                      in project properties open Flex Build Path

                      The last field: Output folder URL.

                       

                      Another way:

                      click on the arrow near Debug button and select "Other"

                       

                      Put urls there for debug, profile and run options.