Reloading new xml file into xml object
Hi im try to reload a new xml file into an xml object when a button is pressed. However it does not seem to be working...it loads the first file "dictionary.xml" successfully, but when i try to reload another xml file "dictionaryMedium.xml" into the XML object when the button is pressed it does not load..in fact when after pressing the button only the trace statement trace(url) shows correctly. It doesnt even go into the onLoad function as trace("failure loading") does not even show... any help wouls be appreciated..thanks a lot
Code:
var dictionary_xml:XML = new XML();
initializeXML("dictionary.xml");
function initializeXML(url:String):Void{
trace(url);
dictionary_xml.ignoreWhite=true;
dictionary_xml.load(url);
dictionary_xml.onLoad = function(bSuccess:Boolean):Void{
if(bSuccess){
trace("success");
trace(dictionary_xml);
}else{
trace("failure loading");
}
}//end onLoad
}//end initializeXML
myButton_btn.onRelease = function():Void{
delete dictionary_xml;
var dictionary_xml:XML = new XML();
initializeXML("dictionaryMedium.xml");
}//end onRelease