Playing with the Google Map API for Flex

Just started experimenting with the Google Map API for Flex, and have uncovered a few things. I been able to get a custom marker to display on the map. The difficulty has been adjusting its offset. I am to set the iconOffset value. I can see that the value is set by calling the MarkerOptions, but this value seems to have no effect on the position of the marker. What I was trying to do, was to center the overlay image (a semi-transparent circle) at a Lat/Long. I was able to uncover an undocumented setting for the IconAlignment property. If you set it to 0x11; this will center the image. I should have the example up and running in a few days.

Here is the snippet of code I am playing with:

 

var dataB:DisplayObject = overlayImage.content;

var pOffset:Point = new Point(-40,-40);

var markerA:Marker = new Marker(

       new LatLng(lat, long),

       new MarkerOptions({

       radius:0,

       dragable: “false”,

       icon:dataB,

       iconOffset: pOffset,

       iconAlignment:  0x11,

       hasShadow: false

   })

);

   map.addOverlay(markerA);

Here is the output from markerA.getOptions():

MarkerOptions:

{ strokeStyle: StrokeStyle: { thickness: 2, color: 0, alpha: 1} 

  fillStyle: FillStyle: { color: 16741994, alpha: 1, gradient: null} 

  label: null

  labelFormat: [object TextFormat]

  tooltip: 1 psi range

  radius: 0

  hasShadow: false

  draggable: false

  gravity: 0.8

  icon: radii_png_512818238_19

  iconAlignment: 17

  iconOffset: (x=-40, y=-40) }

I’ve posted it to the Google Maps forum, but thought I would post it here also.

Advertisements

2 comments

  1. Thanks for the example! I’m doing the same thing, but when I try to set the icon I get an “Invalid BitmapData” error. Did you run into this problem at all?

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s