I'm using Google Maps with Flex 3. I'm using custom markers (custom icons) to mark places on the map. It works fine. The problem is that in some cases, I don't need a custom icon, I need the standard marker.
For example, how would I set condition C's icon to the standard marker:
public funct开发者_StackOverflowion iconSetter():void {
if (condition A blah blah){myIcon=star; myPointsBuilder(); return;}
if (condition B blah blah){myIcon=circle; myPointsBuilder(); return;}
if (condition C blah blah){myIcon=STANDARD MARKER; myPointsBuilder(); return;}
}
In the myPointsBuilder function I create the markers like so:
for (i=0; i < arrayLength; i++) {
myMarker = new Marker(new LatLng(myData[i].latitude, myData[i].longitude), new MarkerOptions({
icon: new myIcon, iconOffset: new Point(2,2), iconAlignment:1, hasShadow:true
}));
markerBoss.addMarker(myMarker, 15, 15);
}
markerBoss.refresh();
I don't know how to revert to the default marker where I wrote "STANDARD MARKER". Any suggestions?
Thank you.
-Laxmidi
Try something like this:
for (i=0; i < arrayLength; i++) {
myMarker = new Marker(new LatLng(myData[i].latitude, myData[i].longitude));
switch(condition)
{
case A:
case B:
myMarket.setOptions(new MarkerOptions({icon: new myIcon, iconOffset: new Point(2,2), iconAlignment:1, hasShadow:true}));
break;
case C: // default, do nothing
break;
}
markerBoss.addMarker(myMarker, 15, 15);
}
markerBoss.refresh();
This is untested, but you get the idea
精彩评论