Google Map: Part Duex

So, someone asked about getting at the Bitmap Data needed for a custom marker in the new Google Map API. Here’s what I did, I added the following MXML to my Flex project:

       <mx:Image source=”@Embed(‘images/radii.png’)” visible=”false” id=”blastOverlayImage/>

You’ll note that I set the visible property to false, so it is not shown. There was no real reason to include the image this way, I could have just loaded it via a loader. Somehow one line of MXML seemed easier than the lines of code needed for loader.

So to prepare image for the MarkerOptions function, I created a new DisplayObject and set it to the image’s content. Once it is assigned to the DisplayObject, you can do various functions on it before you pass it to MarkerOptions. The primary ones I can see are resizing and adjusting the alpha before attaching it your marker. I didn’t see any methods to do this once the marker has been created.

Here’s a snippet of code that does that:

     var dataB:DisplayObject = blastOverlayImage.content; 

    dataB.width = 300;

    dataB.height = 300;

Enjoy!

Advertisements

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