Hello,
I am working with a loader to request an image from a WMS(Web Mapping Service). Everything thing is fine and dandy with a valid request.
When a bad request is made to a WMS, a Standard Exception Document(XML) is usually returned. However, the loader doesn't fire any event (specifically the Complete or IOError events) when a bad request is made.
Does anyone have any suggestions on how I can trap anything that is not an image that might be returned?
override protected function loadMapImage(loader:Loader):void
{
// update parameter values
_params = new URLVariables();
_params.request = "GetMap";
_params.format = "image/png";
_params.version = "1.1.1";
_params.layers = this.layers;
_params.styles = "";
_params.transparent = "TRUE";
_params.bbox = map.extent.xmin + "," + map.extent.ymin + "," + map.extent.xmax + "," + map.extent.ymax;
_params.srs = "EPSG:" + map.spatialReference.wkid;
_params.width = map.width;
_params.height = map.height;
_urlRequest = new URLRequest(this.url);
_urlRequest.data = _params;
configureListeners(loader.contentLoaderInfo);
loader.load(_urlRequest);
}
private function configureListeners(dispatcher:IEventDispatcher):void
{
//dispatcher.addEventListener(Event.INIT, initHandler);
//dispatcher.addEventListener(Event.UNLOAD, unloadHandler);
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
//dispatcher.addEventListener(Event.OPEN, openHandler);
//dispatcher.addEventListener(ProgressEvent.PROGRESS, progressHandler);
//dispatcher.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
//dispatcher.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
dispatcher.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
//dispatcher.addEventListener(Event.ACTIVATE, activateHandler);
//dispatcher.addEventListener(Event.DEACTIVATE, deactivateHandler);
}
private function ioErrorHandler(event:IOErrorEvent):void
{
trace('ioErrorHandler event');
}
private function completeHandler(event:Event):void
{
trace('completeHandler event');
}