<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" 
      xmlns:thr="http://purl.org/syndication/thread/1.0">
  <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html" />
  <link rel="self" type="application/atom+xml" href="http://www.insideria.com/atom.xml" />
  <id>tag:www.insideria.com,2009://34/tag:www.insideria.com,2008://34.23737-</id>
  <updated>2009-11-05T20:10:11Z</updated>
  <title>Comments for Google Releases AS3 Maps API (http://www.insideria.com/2008/05/google-releases-as3-maps-api.html)</title>
  <generator uri="http://www.sixapart.com/movabletype/">Movable Type 4.21-en</generator>
  <entry>
    <id>tag:www.insideria.com,2008://34.23737</id>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html" />
    <link rel="service.edit" type="application/atom+xml" href="http://blogs.oreilly.com/cgi-bin/mt/mt-atom.cgi/weblog/blog_id=34/entry_id=23737" title="Google Releases AS3 Maps API" />
    <published>2008-05-16T03:04:14Z</published>
    <updated>2008-05-16T14:42:51Z</updated>
    <title>Google Releases AS3 Maps API</title>
    <summary>Yep, thats right... Google has released a Flash/AS3 API for Google Maps, and yes, it works with Flex.   I&apos;m very glad to see the Google Maps team take this step, and provide a supported API for their maps interface.  </summary>
    <author>
      <name>Andrew Trice</name>
      
    </author>
    
    <category term="Blogs" />
    
    <content type="html" xml:lang="en" xml:base="http://www.insideria.com/">
      <![CDATA[Yep, thats right... Google has released a <a href="http://code.google.com/apis/maps/documentation/flash/intro.html" target="_blank">Flash/AS3 API for Google Maps</a>, and yes, it works with Flex.   I'm very glad to see the <a href="http://maps.google.com" target="_blank">Google Maps</a> team take this step, and provide a supported API for their maps interface.   <br /><br />

You can access the Google Maps Flash API directly at:<br />
<a href="http://code.google.com/apis/maps/documentation/flash/intro.html" target="_blank">http://code.google.com/apis/maps/documentation/flash/intro.html</a><br /><br />

There are also a bunch of samples how to use Google Maps in your Flex/Flash applications at:<br />
<a href="http://code.google.com/p/gmaps-samples-flash/" target="_blank">http://code.google.com/p/gmaps-samples-flash/ </a><br /><br />

And, Don't forget the Google Maps API Blog:<br />
<a href="http://googlemapsapi.blogspot.com/" target="_blank">http://googlemapsapi.blogspot.com/</a><br /><br />


It's pretty straightforward to use, and can easily integrate with your existing applications.  Here's my example:<br /><br />

<iframe 
src="http://www.tricedesigns.com/portfolio/googleMaps/GoogleMaps2.html"
width="425" height="350" frameborder="0">
</iframe><br /><br />

Here's how I embedded it into a Flex application.   The trick is that you need to manually add the map component to a container in your application.  It did not work when I tried to manually declare the map in MXML.  Also, be sure to sign up for an API key, or else it will not work for you.<br /><br />
<div class="acode" style="overflow: auto; padding: 10px;" ><div style="overflow-x: visible;">
<code language="perl">
<pre> 
&lt;?xml <span class="category2">version</span>="<span class="quote">1.0</span>" encoding="<span class="quote">utf-8</span>"?&gt;
&lt;mx:<span class="category2">Application</span> 
	xmlns:mx="<span class="quote">http://www.adobe.com/2006/mxml</span>" 
    layout="<span class="quote">absolute</span>" 
    <span class="category2">width</span>="<span class="quote">100%</span>" <span class="category2">height</span>="<span class="quote">100%</span>" 
    viewSourceURL="<span class="quote">srcview/index.html</span>"
    <span class="category2">backgroundColor</span>="<span class="quote">#FFFFFF</span>"&gt;
  
  	&lt;mx:Style&gt;
  		<span class="category2">Application</span> {
 		   <span class="category2">backgroundColor</span>: #ffffff;
 		   backgroundGradientColors: #ffffff, #ffffff;
 		}
  	
  		Panel {
 		   borderThicknessLeft: 0;
 		   borderThicknessTop: 0;
 		   borderThicknessBottom: 0;
 		   borderThicknessRight: 0;
 		   cornerRadius: 10;
 		   headerColors: #000000, #999999;
 		}
  	&lt;/mx:Style&gt;
  
	&lt;mx:Script&gt;
		&lt;![CDATA[
			<span class="category1">import</span> com.google.maps.interfaces.IMapType;
		  	<span class="category1">import</span> com.google.maps.LatLng;
		  	<span class="category1">import</span> com.google.maps.Map;
		  	<span class="category1">import</span> com.google.maps.MapEvent;
		  	<span class="category1">import</span> com.google.maps.MapType;
		 
		  	<span class="category1">private</span> <span class="category1">var</span> map:Map;
		  	
		  	<span class="category1">public</span> <span class="category1">function</span> onContinerInitialize( event:Event ):<span class="category1">void</span> 
		  	{
 			    map = <span class="category1">new</span> Map();
 			    map.key = "<span class="quote">put your api key here</span>";
 			    map.addEventListener( MapEvent.MAP_READY, onMapReady );
 			    mapContainer.addChild( map );
 		  	}
		
			<span class="category1">public</span> <span class="category1">function</span> onContainerResize( event:Event ):<span class="category1">void</span> 
			{
 			    map.<span class="category2">setSize</span>( <span class="category1">new</span> Point( mapContainer.<span class="category2">width</span>, mapContainer.<span class="category2">height</span> ) );
 			}
		
		 	<span class="category1">private</span> <span class="category1">function</span> onMapReady( event:Event ):<span class="category1">void</span> 
		 	{
 		 		mapType.dataProvider = [ MapType.PHYSICAL_MAP_TYPE, MapType.NORMAL_MAP_TYPE, MapType.SATELLITE_MAP_TYPE, MapType.HYBRID_MAP_TYPE ];
 			    mapType.selectedIndex = 0;
 			    map.enableScrollWheelZoom();
 			    map.enableContinuousZoom();
 			    map.setCenter(<span class="category1">new</span> LatLng(38.897318, -77.035392), 10, mapType.dataProvider[0] );
 		  	}
		  	
		  	<span class="category1">private</span> <span class="category1">function</span> onChangeMapType() : <span class="category1">void</span>
		  	{
 		  		<span class="category1">if</span> ( mapType.selectedItem )
 		  			map.setMapType( IMapType( mapType.selectedItem ) );
 		  	}
		  	
		  	<span class="category1">private</span> <span class="category1">function</span> labelFunction( <span class="category2">o</span> : <span class="category2">Object</span> ) : <span class="category2">String</span>
		  	{
 		  		<span class="category1">if</span> ( <span class="category2">o</span> is IMapType )
 		  			<span class="category1">return</span> IMapType( <span class="category2">o</span> ).getName();
 		  		<span class="category1">return</span> "<span class="quote"></span>";
 		  	}
		]]&gt;
	&lt;/mx:Script&gt;
		  
	&lt;mx:Panel 
	  	title="<span class="quote">Google Maps Sample</span>" 
	  	top="<span class="quote">5</span>" bottom="<span class="quote">5</span>" left="<span class="quote">5</span>" right="<span class="quote">5</span>"&gt;
	    
	    &lt;mx:UIComponent id="<span class="quote">mapContainer</span>" 
	        <span class="category2">initialize</span>="<span class="quote">onContinerInitialize(event);</span>" 
	        resize="<span class="quote">onContainerResize(event)</span>" 
	        <span class="category2">width</span>="<span class="quote">100%</span>" <span class="category2">height</span>="<span class="quote">100%</span>"/&gt;
	  	
	  	&lt;mx:ControlBar&gt;
	  		
	  		&lt;mx:Label <span class="category2">text</span>="<span class="quote">Map Type</span>" /&gt;
	  		&lt;mx:ComboBox id="<span class="quote">mapType</span>" 
	  			labelField="<span class="quote">label</span>" 
	  			change="<span class="quote">onChangeMapType()</span>" 
	  			labelFunction="<span class="quote">labelFunction</span>" /&gt;
	  			
	  	&lt;/mx:ControlBar&gt;
	  	
	&lt;/mx:Panel&gt;
  
&lt;/mx:<span class="category2">Application</span>&gt;</pre>
</code>

</div></div> <br /><br />

You can launch the example in a new window at:<br />
<a target="_blank" href="http://www.tricedesigns.com/portfolio/googleMaps/GoogleMaps.html">http://www.tricedesigns.com/portfolio/googleMaps/GoogleMaps.html</a>
<br /><br />

You can access the source code in a new window at:<br />
<a target="_blank" href="http://www.tricedesigns.com/portfolio/googleMaps/srcview/index.html">http://www.tricedesigns.com/portfolio/googleMaps/srcview/index.html</a>
<br /><br />
___________________________________<br />
<strong>Andrew Trice</strong><br />
Principal Architect<br />
<a href="http://www.cynergysystems.com" target="_blank">Cynergy Systems
http://www.cynergysystems.com</a>






]]>
      
    </content>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23737-comment:2017187</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23737" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html#comment-2017187" />
    <title>Comment from Pamela Fox on 2008-05-16</title>
    <author>
        <name>Pamela Fox</name>
        <uri>http://imagine-it.org</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://imagine-it.org">
        <![CDATA[<p>Hi Andrew!</p>

<p>Thanks for the great demo. Any interest in having it added to the demo gallery? (I wouldn't be moving the code to our site, just linking back to your site). Let me know! - pamela</p>]]>
    </content>
    <published>2008-05-16T13:49:58Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23737-comment:2017188</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23737" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html#comment-2017188" />
    <title>Comment from Andrew Trice on 2008-05-16</title>
    <author>
        <name>Andrew Trice</name>
        <uri>http://www.tricedesigns.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.tricedesigns.com">
        <![CDATA[<p>Sure, go for it.  Let me know where the demo gallery is, so I can check it out.</p>]]>
    </content>
    <published>2008-05-16T14:04:29Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23737-comment:2017203</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23737" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html#comment-2017203" />
    <title>Comment from Chris Scott on 2008-05-16</title>
    <author>
        <name>Chris Scott</name>
        <uri>http://cdscott.blogspot.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://cdscott.blogspot.com">
        <![CDATA[<p>Andy your so crazy! I just dropped the new google map component into the project I am working on today! One day behind you my man! Keep up the killer posts!</p>]]>
    </content>
    <published>2008-05-17T01:12:31Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23737-comment:2017204</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23737" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html#comment-2017204" />
    <title>Comment from Johan on 2008-05-16</title>
    <author>
        <name>Johan</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Nice demo, thanks for sharing code - got it up and running no problem.</p>]]>
    </content>
    <published>2008-05-17T02:13:28Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23737-comment:2017222</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23737" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html#comment-2017222" />
    <title>Comment from Rob on 2008-05-18</title>
    <author>
        <name>Rob</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>I must be missing something. tho I am totally new to this so this may be a stupid question.</p>

<p>All I did was copy the code into a new flex project in Flex Builder 3 and hit run - comes up with a compile error. What am i missing? This is doing my head in :(</p>

<p>Any help would be appreciated. </p>

<p>Thanks!!</p>]]>
    </content>
    <published>2008-05-19T05:46:17Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23737-comment:2017227</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23737" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html#comment-2017227" />
    <title>Comment from Fabianv on 2008-05-19</title>
    <author>
        <name>Fabianv</name>
        <uri>http://www.fabianvercuiel.com</uri>
    </author>
    <content type="html" xml:lang="en" xml:base="http://www.fabianvercuiel.com">
        <![CDATA[<p>Now that is one speedy map.. seems to perform much better than the Ajax version</p>]]>
    </content>
    <published>2008-05-19T09:08:35Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23737-comment:2017259</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23737" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html#comment-2017259" />
    <title>Comment from chris on 2008-05-20</title>
    <author>
        <name>chris</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Thanks for the great post!  I'm totally new to the map API and I have a question: can a KML layer be added to this easily?  Does the GGeoXml method work with this?</p>

<p>Thanks!</p>]]>
    </content>
    <published>2008-05-20T16:26:23Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23737-comment:2017466</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23737" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html#comment-2017466" />
    <title>Comment from MArcio on 2008-05-30</title>
    <author>
        <name>MArcio</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p><a href="http://www.rarusflats.com.br/google_maps_sem_module/google_maps_sem_module.html">http://www.rarusflats.com.br/google_maps_sem_module/google_maps_sem_module.html</a></p>

<p>Because the Drag not is functional im my example ?</p>

<p>Is a copy of your code</p>]]>
    </content>
    <published>2008-05-30T23:56:47Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23737-comment:2017469</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23737" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html#comment-2017469" />
    <title>Comment from MArcio on 2008-05-30</title>
    <author>
        <name>MArcio</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>Because in module No Drag e No Switch Map Type</p>

<p><a href="http://www.rarusflats.com.br/google_maps_com_module/google_maps_com_module.html">http://www.rarusflats.com.br/google_maps_com_module/google_maps_com_module.html</a></p>]]>
    </content>
    <published>2008-05-31T02:47:13Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23737-comment:2018068</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23737" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html#comment-2018068" />
    <title>Comment from Steve_N on 2008-06-20</title>
    <author>
        <name>Steve_N</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>A hint:<br />
Don't waste your time trying this in Adobe AIR.<br />
It won't work due to licensing-restrictions!<br />
</p>]]>
    </content>
    <published>2008-06-20T19:36:30Z</published>
  </entry>

  <entry>
    <id>tag:www.insideria.com,2008://34.23737-comment:2069925</id>
    <thr:in-reply-to ref="tag:www.insideria.com,2008://34.23737" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html"/>
    <link rel="alternate" type="text/html" href="http://www.insideria.com/2008/05/google-releases-as3-maps-api.html#comment-2069925" />
    <title>Comment from Erin on 2009-08-06</title>
    <author>
        <name>Erin</name>
        <uri></uri>
    </author>
    <content type="html" xml:lang="en" xml:base="">
        <![CDATA[<p>This works great for me. The one question I have is how do I get it to animate the combo box like you did, where it gracefully slides up and down?  Mine just jumps up and down.  Thanks!</p>]]>
    </content>
    <published>2009-08-06T22:41:29Z</published>
  </entry>

</feed
