6 Replies Latest reply on Apr 21, 2009 7:54 PM by Michael Borbor

    Execute a server-side script

    essa tkinen

      anyone no how to execute a server side php script with out sending it any variables or receiving any variables and not opening up a new window.

       

      Error #2030: End of file was encountered. this is the error I get when using this code

       

      What the php file does is encode flv files. It calls it self tell all the uploaded videos in the cue database list are converted. So I upload 3 videos the script takes and does the 1st file then 2nd and then 3rd. In the flash player I get error 2030 every time the script call .its self.

       

      If I just call the php script outside of flash with a browser it works perfectly.

       

      I've been using all kinds of variations of URLRequest and URLLoader really stumped . Thanks flexperts.

       

       

      private function encodeHandler(event:DataEvent):void

      {

       

      var variables:URLVariables = new URLVariables();

       

      variables.fileName = 'd';

      variables.fileExt = 's';

       

      var request:URLRequest = new URLRequest("http://" + ModelLocator.SERVER + "/scripts/videoConvert.php")

      request.method = "get";

      request.data = variables;

       

       

      var loader:URLLoader = new URLLoader();

      loader.dataFormat = URLLoaderDataFormat.VARIABLES;

      loader.addEventListener(Event.COMPLETE, completeHandler);

      loader.addEventListener(flash.events.HTTPStatusEvent.HTTP_STATUS,onStatus);

       

      try

      {

      //status.text = "Encoding video...";

          loader.load(request);

          trace('start encoding');

      }

       

      catch (error:Error)

      {

          //status.text = "Unable to load URL";

          trace('encoding error cant load url');

         

      }

       

      function onStatus(event:HTTPStatusEvent):void

      {

      if (event.status != 0) {

          //status.text = "Encoding Error";

          trace('encoding error');

      }

      }

       

      function completeHandler(event:Event):void

      {

      //status.text = "Encoding Complete";

      trace('encoding complete');

          }

       

       

      }