Tengo este código:
Código ActionScript :
public function leeXML():void{ var url:String = ".... ruta a un archivo XML ..."; var loader:URLLoader; try{ loader = new URLLoader(); loader.addEventListener(Event.COMPLETE, xmlCompleto); loader.addEventListener(ErrorEvent.ERROR , xmlErr); var peticion:URLRequest = new URLRequest(url); loader.load(peticion); }catch(e:Error){ depura("Error: "+e); Alert.show("Error: "+e); } } public function xmlErr(e:Event):void{ depura("xmlError: "+e.toString()); Alert.show("Error: "+e.toString()); }
cuando no encuentra un archivo XML, me da este error:
Código ActionScript :
Error #2044: ioError no controlado: text=Error #2032: Error de secuencia. URL: http://localhost/xxxxxxxxxx.xml at xxx/leeXML()[Xml.as:50] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete()
La línea 50 es esta: loader = new URLLoader();
El problema es que me gustaría capturar el error de cuando no se encuentra un archivo xml, para mostrar un mensaje al usuario, pero no veo la forma de hacerlo... ¿alguna idea?
GRACIAS.