4 Replies Latest reply on Sep 6, 2012 1:45 PM by IsraelMarsilli

    security error 2148 while calling local perl code.

    xsrijith01

      I use Linux with flex SDK.
      SO I have to write mxml in vi editor and compile it using  “mlmlc  code.mxml” which will generate a swf file and then run it using “firefox  code.swf”

      Here is the code what I used to call local perl script. My perl script and the code.mxml file are in same directory.

       

      var myTextLoader:URLLoader = new URLLoader();

      myTextLoader.addEventListener(Event.COMPLETE, onLoaded);

      function onLoaded(e:Event):void {
      trace(e.target.data);
      }

      myTextLoader.load(new URLRequest(“perlcode.pl”));

       

      Notice how I called local perl code in the last line.

       

       

      I then  installed debug version of flex and you are rite!!
      I am getting following error

       

      An ActionScript error has occurred:
      SecurityError: Error #2148: SWF file  file:///home/mac/flexworks/flex/actionscript/src/com/example/quickstart/hw.swf  cannot access local resource  file:///home/mac/flexworks/flex/actionscript/src/com/example/quickstart/vlcplyr.pl.  Only local-with-filesystem and trusted local SWF files may access local  resources.
      at flash.net::URLStream/load()
      at flash.net::URLLoader/load()
      at com.example.quickstart::hw/alertListener()
      at com.example.quickstart::hw/__fname_click()

       

       

      However I configured crossdomain.xml iin my system(ubuntu) and I was  not sure where to place it. I know I have to place it in my root  directory.
      So I placed it in following directories  /  , /home , /home/username/  , /root

      here is the content of the crossdomain file

      I am not sure about the content of the file.

      Also I added two lines to my mxml code
      import mx.events.FlexEvent;
      protected function applicationCompleteHandler(event:FlexEvent):void
      {
      Security.loadPolicyFile(“file:///crossdomain.xml”);
      }
      my perl code and mxml are both located at
      /home/mac/flexworks/flex/actionscript/src/com/example/quickstart

      I still get same security error.

       

       

      I also changed  use-network = false in flex-config.xml

      but I get a different error bcoz i have added

      xmlns:mx=”http://www.adobe.com/2006/mxml”

      in my mxml

       

      Hope I am clear about my problem. Any help is appritiated.