Last week I realized that I could create map markers using the Google Maps API for Flash and the Degrafa framework. I believe creating interactive markers in MXML this way is much easier than the alternatives.
I whipped up this example app, which shows how to extend OverlayBase and implement the IMarker interface. Read here for my comments about extending OverlayBase. The IMarker interface is mostly self explanatory, however, there were a couple of methods I did not bother implementing.
I'd also like to mention that in my experiments I was able to add numerous Flex components to a Google Map: Canvas, Panel, Button, TextInput, etc! It's quite wonky, but it works to some degree. More on this later...
Caveats with these markers
- Need to figure out how to change the "z order" (or child order) of markers when they are clustered close together (like the real Marker class does).
- If using these w/MarkerManager, you need to modify the method signatures in MarkerManager to accept IMarker instead of Marker.
- These are the result of an afternoon's experiments, the code is not necessarily optimal.
I'm still wrapping my head around all the things you can do with Degrafa. The more I work with it, the more I like it.
Cheers,
Sunil