Skip to content

Commit

Permalink
Modified URLFetcher for Flash Player constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
capilkey committed May 21, 2015
1 parent 356db13 commit 52156e7
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package org.bigbluebutton.lib.common.utils {

protected var _urlRequest:URLRequest = null;

protected var _responseUrl:String = null;
protected var _responseURL:String = null;

public function get successSignal():ISignal {
return _successSignal;
Expand All @@ -39,27 +39,29 @@ package org.bigbluebutton.lib.common.utils {
//_urlRequest.followRedirects = true; // only available in AIR, defaults to "true"
_urlRequest.method = URLRequestMethod.GET;
}
_urlRequest.url = url;
_urlRequest.url = _responseURL = url;
var urlLoader:URLLoader = new URLLoader();
urlLoader.addEventListener(Event.COMPLETE, handleComplete);
urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
urlLoader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, httpResponseStatusHandler);
if (HTTPStatusEvent.HTTP_RESPONSE_STATUS) { // only available in AIR, see http://stackoverflow.com/questions/2277650/unable-to-get-http-response-code-headers-in-actionscript-3
urlLoader.addEventListener(HTTPStatusEvent.HTTP_RESPONSE_STATUS, httpResponseStatusHandler);
}
urlLoader.dataFormat = dataFormat;
urlLoader.load(_urlRequest);
}

private function httpResponseStatusHandler(e:HTTPStatusEvent):void {
_responseUrl = e.responseURL;
trace("Redirected to " + _responseUrl);
_responseURL = e.responseURL;
trace("Redirected to " + _responseURL);
}

private function httpStatusHandler(e:HTTPStatusEvent):void {
// do nothing here
}

private function handleComplete(e:Event):void {
successSignal.dispatch(e.target.data, _responseUrl, _urlRequest);
successSignal.dispatch(e.target.data, _responseURL, _urlRequest);
}

private function ioErrorHandler(e:IOErrorEvent):void {
Expand Down

0 comments on commit 52156e7

Please sign in to comment.