Hi
Simple question to do with variable scope, when using something like
GDownloadUrl how do you access a gloabal variable i.e. populate the array in
the example below? Do I pass in the variable name, use return? Always get
confused about this with inner functions. Thanks in advance.
Garrett
//hold all ids
var latlongids = new Array();
var test = GDownloadUrl("map.osm.xml", function(data, responseCode) {
//if ok
if (responseCode == 200)
{
var xml = GXml.parse(data);
var way = xml.documentElement.
getElementsByTagName("nd");
for (var i = 0; i < way.length; i++)
{
var id = way[i].getAttribute("ref");
latlongids[i] = id;
}
}
else if(responseCode == -1)
{
alert("Data request timed out. Please try later.");
}
else
{
alert("Request resulted in error. Check XML file is retrievable.");
}
});
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.