Does anyone know how I can catch "Error opening URL ‘http://badurl’ " error when calling NetConnection.connect() ? If the server goes down and connect() fails. I see the error in the output but none of my try{} or eventlistener could catch it.
gateway = new NetConnection();
gateway.objectEncoding = ObjectEncoding.AMF3;
gateway.addEventListener( NetStatusEvent.NET_STATUS, netStatusHandler );
gateway.addEventListener( IOErrorEvent.IO_ERROR, netIOHandler);
gateway.addEventListener( HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
gateway.addEventListener( SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
gateway.connect( gw_url );
If gw_url is bad. All I see in the output is Error opening URL. I’ve even tried wrapping the connect around a try{}catch{e: Error}
netStatusHandler will report “NetConnection.Call.Failed” but the Error opening URL prevents the script from proceeding.
Also, “NetConnection.Connect.Success” is never fired even on success! I’m so lost.
Here are the output when gw_url is bad.
Error opening URL ‘http://www.baddomain.com’
netStatusHandler: NetConnection.Call.Failed