Question
Need help with setting a variable using actionscript
So I am trying to import in XML and this is working fine, But
once in flash I need to reference this variable in a later script.
Here is what I got.
function loadXML(loaded) {
if (loaded) {
/////this is the variable, which is working, it pulls the info from the xml document properly.
var node1 = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
////another variable, etc...
var node2 = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
/////when traced it outputs the proper value.
trace(node1);
}}
////////does not work here though.
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("co.xml");
var latmin = 37;
var latmax = 41;
var lonmin = -109;
var lonmax = -102;
this.geoPlotter_gp.setRange(latmin, latmax, lonmin, lonmax);
this.geoPlotter_gp.setNodeSymbol("geoPloterNodeSymbol");
this.geoPlotter_gp.addNode(40.48, -107);
////////////////This is where I need to now use the variables defined above//////////////
this.geoPlotter_gp.addNode(node1);// Boulder
this.geoPlotter_gp.addNode(node2);// Denver
/////any ideas all? I am sure this is something simple...I am just overlooking something.
function loadXML(loaded) {
if (loaded) {
/////this is the variable, which is working, it pulls the info from the xml document properly.
var node1 = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
////another variable, etc...
var node2 = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
/////when traced it outputs the proper value.
trace(node1);
}}
////////does not work here though.
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("co.xml");
var latmin = 37;
var latmax = 41;
var lonmin = -109;
var lonmax = -102;
this.geoPlotter_gp.setRange(latmin, latmax, lonmin, lonmax);
this.geoPlotter_gp.setNodeSymbol("geoPloterNodeSymbol");
this.geoPlotter_gp.addNode(40.48, -107);
////////////////This is where I need to now use the variables defined above//////////////
this.geoPlotter_gp.addNode(node1);// Boulder
this.geoPlotter_gp.addNode(node2);// Denver
/////any ideas all? I am sure this is something simple...I am just overlooking something.