I found what may be causing the problem, but have yet to figure out the 
solution. The project reads a CSV file to check for updated data which then 
updates the position, icon, and color of the marker. I'm using an 
ENTER_FRAME loop to update the data and the marker. When I took the 
createMarker() code out into a separate file it worked fine up until I added 
the ENTER_FRAME loop. 

So my new question: 
The function following that event tests to see if the marker already exists 
and updates it, if it does not exist it creates it. Does this update 
function override the MapMouseEvent listener?


function onload(event:Event):void {
var dataRows:Array = [];
dataRows = event.target.data.split(/\r\n|\n|\r/);
for (var i:int=1; i<dataRows.length; i++) {
var content:Array = dataRows[i].split(",");
var type:String = content[0];
var id:String = content[1];
var co:String = content[2];
var capacity:Number = content[3];
var gals:Number = content[6];
var latlng:LatLng = new LatLng(content[7],content[8]);
var fuelpct:Number = gals/capacity*100;
var grade:String = content[4];
var refuel:String = content[5];
var timestamp:String=content[9];
if (markerObjects[i]) {
updateMarker(i, latlng, fuelpct, type, id, co, capacity, grade, refuel);
} else {
createMarker(i, latlng, fuelpct, type, id, co, capacity, grade, refuel);
timestampTxt.text = timestamp;
}
}
}

function updateMarker(i:int, latlng:LatLng, fuelpct:Number, type:String, 
id:String, co:String, capacity:Number, grade:String, refuel:String):void {
var myIcon:Icons = new Icons();
myIcon.gotoAndStop(type);
var tank:String;
var colorInfo:ColorTransform = myIcon.back.transform.colorTransform;
switch (true) {
case fuelpct >= 80 :
colorInfo.color = 0x009900;
tank = "full";
break;
case fuelpct >= 50 :
colorInfo.color = 0xFF9900;
tank = "half";
break;
case fuelpct < 50 :
colorInfo.color = 0xFF0000;
tank = "empty";
break;
}
myIcon.back.transform.colorTransform = colorInfo;
var options:MarkerOptions = new MarkerOptions({icon: myIcon});
var marker:Marker = markerObjects[i][0];
marker.setLatLng(latlng);
marker.setOptions(options);
markerObjects[i].splice(1,8, id, type, co, capacity, grade, refuel, fuelpct, 
tank);
}

function createMarker(i:int, latlng:LatLng, fuelpct:Number, type:String, 
id:String, co:String, capacity:Number, grade:String, refuel:String):void {
var myIcon:Icons = new Icons();
myIcon.gotoAndStop(type);
var tank:String;
var colorInfo:ColorTransform = myIcon.back.transform.colorTransform;
switch (true) {
case fuelpct >= 80 :
colorInfo.color = 0x009900;
tank = "full";
break;
case fuelpct >= 50 :
colorInfo.color = 0xFF9900;
tank = "half";
break;
case fuelpct < 50 :
colorInfo.color = 0xFF0000;
tank = "empty";
break;
}
myIcon.back.transform.colorTransform = colorInfo;
var options:MarkerOptions = new MarkerOptions({icon: myIcon});
var marker:Marker = new Marker(latlng, options);
var html:String = "<b>" + id + "</b><br />" + type;
marker.addEventListener(MapMouseEvent.CLICK, function(e:MapMouseEvent):void 
{
marker.openInfoWindow(new InfoWindowOptions({contentHTML:html}));
});
markerObjects[i] = [marker, id, type, co, capacity, grade, refuel, fuelpct, 
tank];
map.addOverlay(marker);
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-api-for-flash/-/WHVsia1ef_AJ.
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.

Reply via email to