3 Replies Latest reply on May 22, 2011 5:32 AM by blazejewicz

    loading remote swf through php in air


      Hello i use this code to import a remote swf through a remote php file


      this works with flash player but not with Air





      this is code:



      var scriptName  :String = "http://www.xxx.com/readSWF.php";  
      var codeErr     :int;
      var requestPHP  :URLRequest;
      var loader      :URLLoader;
      var varsToPHP   :URLVariables;
      var varsFromPHP :URLVariables;
      var loaderSWF   :Loader;

      requestPHP        = new URLRequest(scriptName);
      requestPHP.method = URLRequestMethod.POST;
      varsToPHP         = new URLVariables();
      loader            = new URLLoader();
      loader.dataFormat = URLLoaderDataFormat.BINARY;


      loader.addEventListener(Event.COMPLETE, completePHP);




      btn_Read.addEventListener(MouseEvent.CLICK, readSWF);


      function readSWF(evento:MouseEvent):void

          varsToPHP.fileName = "test.swf";
          requestPHP.data = varsToPHP;


      function completePHP(evento:Event):void

          var bytesFromPHP:ByteArray = new ByteArray();
          bytesFromPHP = loader.data;


          loaderSWF = new Loader ();
          loaderSWF.contentLoaderInfo.addEventListener(Event.COMPLETE, caricatoSWF);



      function caricatoSWF(evento:Event):void
          var objSWF:MovieClip = evento.target.content;

          objSWF.x = 1;
          objSWF.y = 737;






      Can you help me to modify it to make it work with air too? Thanks