0
votes

I am running an embedded flash 'swf' inside a LAN network with a proxy server. Proxy server interrupts some urls and returns my usage information. I am trying to access this information by sending those urls. I can see this traffic in firebug ,But the URLLoader does not seem to read it. Neither Complete event or progress event get fired. I tried URLStream with a timer also,but availableBytes were always zero.Is it possible to read this information?

  private var getLoader:URLLoader = new URLLoader();
  private var sendRequest:URLRequest = new URLRequest();
  public function XDomain() {
   sendRequest= new URLRequest("requesturl");
   getLoader.addEventListener(Event.COMPLETE, eventHandler);
   getLoader.addEventListener(ProgressEvent.PROGRESS,eventHandler2);
   getLoader.load(sendRequest);
  }
  private function eventHandler(event:Event):void {
    trace("running");
  }
  private function eventHandler2(event:ProgressEvent):void {
   trace("runninhg progresss");
  }

Thanks in advance // Edit: I had this security error

[SecurityErrorEvent type="securityError" bubbles=false cancelable=false eventPhase=2 text="Error #2048"]
1
Please listen to SecurityErrorEvents and HTTPStatusEvents and lets see what it says. - phasma
@Jacob HTTPStatusEvent listner is blocking my code.Is there something I am missing? //getLoader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, httpHandler);// .trace after this does not run. - feminkk
"URLStream with a timer" why??? Is there a result if you let it work naturally, without a timer interrupting? URLStream is your best bet since it gives raw access to server response. If still failing, show your URLStream code or give testable link that re-produces your issue. - VC.One
None of the events were firing that is why i used a timer to return getLoader.bytesAvailable .I guess it wont do anything. - feminkk
About events you have an import flash.events.*; in your code? Does it help to add that? The not running trace is inside httpHandler function right?... Anyways URLLoader itself isn't going to show you any server's response text. Show me how you instead tried URLStream (short example, testable in our own compilers). I'm seriously struggling to not make it work in my own tests so either your URLStream code is wrong or else share an example/testable link to the crazy server. - VC.One

1 Answers

0
votes

"But the URLLoader does not seem to read it..."

Use URLStream (without a timer, cos what does that even achieve?) to reach the link and inside your related progressEvent use a readUTFBytes to get any text response data given by that link's server. Use progressEvent to also check size of any received bytes (the event fires multiple times, getting 64kb packets, until full data is downloaded).

about Error #2048:
URLloader is a decoder for visual data (jpg, png, swf, text) but for non-text data it expects a crossdomain.xml to exist at the other server you are accessing the swf from (both sides must also have a matching same http or https. Again best way to by-pass this is to just load the bytes into a byte array (via URLStream but the progressEvents now should write to your byte array) then later use URLLoader.loadBytes( yourSWFBytes );