3 Replies Latest reply on Oct 8, 2010 12:05 PM by ShanthiFlash

    Error #2048: Security sandbox violation

    ShanthiFlash Level 1

      Hi,

      This is my frist try with HTTP service.I installed xampp server, and Have a PHP file in the path
      C:\xampp\htdocs\service.php

       

      <html>
      <body>
      <?php
      $id_number = $_GET["id"];
      echo('<?xml version="1.0" encoding="utf-8" ?>');
      echo('<xml><author><id>'.$id_number.'</id><name>jai</name><age>30</age><author><xml>');
      ?>
      </body>
      </html>


      Have a crossdomain.xml file in the path C:\xampp\htdocs\crossdomain.xml

       

      <?xml version="1.0"?>
      <!DOCTYPE cross-domain-policy SYSTEM "
      http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
      <cross-domain-policy>
          <site-control permitted-cross-domain-policies="all" />
          <allow-access-from domain="localhost" to-ports="*" secure="true"/>
          <allow-http-request-headers-from domain="localhost"/>
      </cross-domain-policy>


      My mxml file code phpwithflex.mxml

       

      <?xml version="1.0" encoding="utf-8"?>
      <s:Application xmlns:fx="
      http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" width="621">
      <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
        <s:HTTPService url="
      http://localhost/service.php " id = "service" result="serviceResult(event)" fault="serviceFault(event)" method="GET" contentType="application/xml" useProxy="false">
         <s:request xmlns="">
          <id>{requestedId}</id>
         </s:request>
        </s:HTTPService>
      </fx:Declarations>
      <fx:Script>
        <![CDATA[
         import mx.rpc.events.FaultEvent;
         import mx.rpc.events.ResultEvent;
        
         [Bindable] private var requestedId:Number;
        
         private function serviceResult(e:ResultEvent):void
         {
          trace(service.lastResult.name)
         }
        
         private function serviceFault(e:FaultEvent):void
         {
          trace("broken service")
         }
        
         private function callService():void
         {
          requestedId = input.text as Number;
         }
        ]]>
      </fx:Script>
      <s:TextInput id="input"  x="32" y="66"/>
      <s:Button label="get user name" click="callService()"  x="125" y="154"/>
      <s:TextArea text="{service.lastResult.name}"  width="149" height="30" x="183" y="76"/>
      <s:TextArea text="{service.lastResult.age}"  width="160" height="26" x="187" y="42"/>
      </s:Application>


      When i run the mxml file from flash builder 4 i get the error

       

      Error #2048: Security sandbox violation: http://localhost//phpwithflex.swf cannot load data from http://localhost//osmf_flex.4.0.0.13495.swf.

       

      Please help me to solve this.What the error i am doing?
      Where I have to put my phpwithflex.swf file?

       

       

      Thanks,

      Shanthi.AL