Unable to display Google Map through API in Flex SDK

Posted by Spero.ShiroPetto on Stack Overflow See other posts from Stack Overflow or by Spero.ShiroPetto
Published on 2010-03-26T23:06:29Z Indexed on 2010/03/26 23:13 UTC
Read the original article Hit count: 380

Filed under:
|
|

Hello,

I am using the mxmlc to compile the examples from google to get started in using Google Maps API in Flex 4. But after compiling the swf file the map does not load.

I've registered for an API key Downloaded and included the Maps SDK in the xml config file used at compile time C:\sdk\flex4\frameworks\flex-config.xml

<external-library-path>
    <path-element>libs/google/maps/lib/map_flex_1_18.swc</path-element>
</external-library-path>

Foo.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<maps:Map xmlns:maps="com.google.maps.*" id="map" mapevent_mapready="onMapReady(event)" 
  width="100%" height="100%" key="{KEY}"/>
<mx:Script>
    <![CDATA[

    import com.google.maps.LatLng;
    import com.google.maps.Map;
    import com.google.maps.MapEvent;
    import com.google.maps.MapType;

    private function onMapReady(event:Event):void {
      this.map.setCenter(new LatLng(40.736072,-73.992062), 14, MapType.NORMAL_MAP_TYPE);
    }
    ]]>
</mx:Script>
</mx:Application>

Any tips on where to go from here? I can compile a basic flex project without problem and displays the components I put in so i'd imagine it's something to do with the API Key?

Thanks for the help

© Stack Overflow or respective owner

Related posts about google-maps-api

Related posts about aptana