Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / April 2006



Tip: Looking for answers? Try searching our database.

Need help with setting a variable using xml

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GDrider - 27 Apr 2006 00:47 GMT
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 - 28 Apr 2006 04:52 GMT
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.

Signature

Lon Hosford
www.lonhosford.com
May many happy bits flow your way!

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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.