I’m trying to load an XML file from the internet in a CD-ROM flash application and seem to be getting nowhere.
The XML object needs to retrieve the results of a PHP script with 2 variables.
The first being T (territory), and the second TYPE (type).
The TYPE variable is currently fixed. In this situation, we will consider its value: ‘bsc’.
I have tried an on(change) handler on the ComboBox, and gotten it to at least produce the correct URL with both GET variables, but the XML object refuses to load.
I have tried using trace() outputs, the debugger, and every permutation of my code I can think of … but with no results.
I do know that my PHP code is working properly, and IS generating the output I exactly expect.
What am I doing wrong, is there an access restriction between a local Flash file and the internet?
My code is as follows:
certifier_xml= new XML();
certifier_xml.ignoreWhite = true;
certifier_state.change = function()
{
us_state = this.getItemAt(this.selectedIndex).label;
certifier_xml.load("[http://www.mydomain.com/get_cert_xml.php?T="+us_state+"&TYPE=bsc](http://www.mydomain.com/get_cert_xml.php?T=)");
}
certifier_xml.onLoad = function(success) {
if (!success){
results_txt.text = "Can not access certifier list. Please visit http://www.mydomain.com for more information.";
} else {
DisplayNodes(certifier_xml.firstChild.childNodes,results_txt);
}
}
/**
* DisplayNodes()
* @param String[] nodes
* @param String field_txt
*/
DisplayNodes = function(nodes, field_txt){
field_txt.htmlText = "";
for (var i=0; i<nodes.length; i++){
var entry ="";
for(j=0;j<nodes*.childNodes.length;j++)
{
entry += nodes*.childNodes[j].firstChild.text;
}
field_txt.htmlText += entry+"
";
}
}