Greetings from Beautiful Boise, Idaho, norton_ag,
I'm not a very good ActionScript coder, but I recently went through
learning how to parse XML and populate a Map with Markers-thanks to
some new friends on this forum.
Here's what I've done-simplified-after displaying the map and adding
controls:
//When MAP_READY, URLLoader.load(URLRequest),
mapA.addEventListener(MapEvent.MAP_READY, setUpLoadXML);
function setUpLoadXML(e:MapEvent):void {
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, processXML);
xmlLoader.load(new URLRequest("data.xml"));
}
//Process .xml File into XML Object, call parseData()
function processXML(e:Event):void {
e.target.removeEventListener(Event.COMPLETE, processXML);
try{
var xmlData = new XML(e.target.data);
parseData(xmlData);
}catch (e:Error){
trace("Error Parsing XML: " +e.message);
}
}
//parseData()
function parseData(xmlData):void {
var dataList:XMLList = xmlData.rootXMLNode;
var i:int;
for(i=0; i<propertyList.length(); i++){
var markerName:String = dataList[i].PropertyName;
var markerLatitude:Number = dataList[i].GoogleLatitude;
var markerLongitude:Number = dataList[i].GoogleLongitude;
var markerLatLng:LatLng = new LatLng(dataList[i].GoogleLatitude,
dataList[i].GoogleLongitude);
var markerOptions = new MarkerOptions();
with (markerOptions) {
clickable = true;
draggable = false;
hasShadow = true;
tooltip = dataList[i].GoogleLatitude+" "+dataList[i].GoogleLongitude;
}
function createMarker():void {
var iterationMarker:Marker = new Marker(markerLatLng, markerOptions);
}
createMarker();
mapA.addOverlay(iterationMarker);
}
Now, I'm pretty sure you can easily call up and populate InfoWindows
using that basic framework. I also hope I didn't make any glaring
errors in this code-I pulled it out in pieces from my completed project
and may have done something dumb.
Good luck on your project!
--
You received this message because you are subscribed to the Google Groups
"Google Maps API For Flash" 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-for-flash?hl=en.