Groups | Blog | Home
all groups > flash data integration > april 2006 >

flash data integration : Need help with setting a variable using xml


GDrider
4/26/2006 11:47:49 PM
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.childNodes.firstChild.nodeValue;

////another variable, etc...
var node2 = this.firstChild.childNodes.childNodes.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.
Motion Maker
4/27/2006 11:52:41 PM
var node1 is a local variable to the loadXML function and not visible
outside the function.

Place var node1 on the timeline say in Frame 1 and it will be visible to all
functions on the timeline.




--
Lon Hosford
www.lonhosford.com
May many happy bits flow your way!
[quoted text, click to view]
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.childNodes.firstChild.nodeValue;

////another variable, etc...
var node2 = this.firstChild.childNodes.childNodes.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.

AddThis Social Bookmark Button