1 Reply Latest reply on Jul 29, 2009 7:40 AM by Iteryx

    Flex 3 and Flash Policy Server

    Iteryx Level 1

      Hello. This is sort of a continuation of a Flex 4 beta post I made about a month back.I am trying to get a simple Flex 3 application to connect to a small Java server that sends out a simple "Ping!" string once a TCP connection is established. I am using XMLSocket to connect to the Java program and I am constatntly getting a security sandbox error.


      Can someone link me a guide, tutorial or just anything to teach me how all this stuff works? I have already read quite a bit on this stuff and none of it is helping.



        • 1. Re: Flex 3 and Flash Policy Server
          Iteryx Level 1


          Hello again. Thought I’d review what I have tried doing the last day or two to try and solve this cross-domain policy problem.


          What I am running: ( all of these are in a Eclipse )

          1. Java Flash Server that listens for a connection on port 843 and then sends the crossdomain.xml file over TCP. Uses a Server Socket and Socket connection classes.

          Crossdomain file:

          <?xml version="1.0"?>

          <!DOCTYPE cross-domain-policySYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">


          <site-control permitted-cross-domain-policies="all"/>

          <allow-access-from domain="*" to-ports="*"/>


          1. Java Ping Server that sends out a string “PING!” every five seconds. Uses ServerSocket and Socket to listen for connection.
          2. Flex 3 Application that establishes a connection with Java Ping Server and listens for any messages; if one is received, shows it in a text box. Using XMLSocket to connect to Ping Server.


          The error:


          • Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: file:///C:/[dir]/bin-debug/CDApp.swf cannot load data from
            • at CDApp/pingServer()[C:\sandbox\clark\CustomComp\src\CDApp.mxml:15]
            • at CDApp/___CDApp_Application1_creationComplete()[C:\sandbox\clark\CustomComp\src\CDApp.mxml :3]
            • at flash.events::EventDispatcher/dispatchEventFunction()
            • at flash.events::EventDispatcher/dispatchEvent()
            • at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.2.0\frameworks\projects\framework\src \mx\core\UIComponent.as:9298]
            • at mx.core::UIComponent/set       initialized()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as :1169]
            • at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects \framework\src\mx\managers\LayoutManager.as:718]
            • at Function/http://adobe.com/AS3/2006/builtin::apply()
            • at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framew ork\src\mx\core\UIComponent.as:8628]
            • at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framewo rk\src\mx\core\UIComponent.as:8568]


          Attempts: ( all failed )

          1. With each of these attempts, Java Flash Server sent cross-domain xml as a      string to Flex App:
            1. Running it straight through – no Security.loadPolicyFile()
            2. Running it with Security.loadPolicyFile(http://myip:843)
            3. Running it with Security.loadPolicyFile(http://myip/crossdomain.xml
            4. I have an Orion server at my disposal on my localhost, so I ran these tests with crossdomain in the root directory:

                                                                        i.      Security.loadPolicyFile(http://localhost:843)

                                                                      ii.      Security.loadPolicyFile(

                                                                    iii.      Security.loadPolicyFile(http://localhost/crossdomain.xml)

                                                                    iv.      Security.loadPolicyFile(

          1. With the following attempts, Java Flash Server gave me no indication it received a request for policy file:
            1. Running it with Security.loadPolicyFile(xmlsocket://myip:843)
            2. I have not run it as exhaustively with xmlsocket since the Java Flash Server did not indicate it received a request.


          I have read quite extensively all over Google and many Adobe articles about cross-domain.xml and setting up Flash Policy Servers. Also, I have found FlashPlayerTrust articles and have tried to implement them as well. In addition, I have altered my global flash player settings to accept anything. None of these sources have helped.


          Also, our company recently bought Flex 3 licenses after experiment on the beta for Flex 4. The same problem existed there as well. I posted on the Flex 4 forums as well, and although I got suggestions on what to do, none of it worked.


          Link to prior Flex 4 post:



          My questions/comments:

          1. It could be something to do with the Eclipse environment I am developing inside of. Does anyone know of Eclipse issues with Flex TCP ( XMLSocket ) connections?
          2. Does my cross-domain.xml file look correct?
          3. I have my crossdomain file in the home directory where Orion server looks for files to load, I think that is where it is supposed to be. If not, please correct me.


          Any assistance would be appreciated. Also, if you have questions about how I have implemented any of these files, please ask so I can clarity.


          Thank you in advance for your response.