Hi
I need to have an error message inside a textbox when the xml is not loaded:
My code is simples and is working:
var xmlURL:String ="http://somesite.com/somefile.xml
loadBtn.addEventListener(MouseEvent.CLICK, clickLoadBtn);
function clickLoadBtn(e:MouseEvent):void {
xmlURL=url.text;
trace(“click load”);
trace(xmlURL);
statusvar.text=“loading XML…”;
////////
var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = new XML();
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest(xmlURL));
function LoadXML(e:Event):void {
xmlData=new XML(e.target.data);
trace(xmlData);
xmltext.text = xmlData;
statusvar.text="XML loaded! If you want to save in a different location or file name please change the URL on top.";
}
}
How do I check if the loadXml worked and if not show an error message inside my statusvar textfield.
Thanks