Reputation: 11
Can anybody tell me, how I can use Google Map API V3 for Flex 4 Application.
Currently, my application is using the Google Map API (map_flex_1_18b.swc), as it is deprecated. I want to use Google Map API V3.
Upvotes: 1
Views: 5185
Reputation: 1146
Google Maps API v3 is only for javascript as indicated in the Google site.
You will have to use the old v2 for using it.
With respect stageWebView, i do not recommend it due to you have no control over it.
Upvotes: 0
Reputation: 15955
Flex AIR can implement a StageWebView:
Implemented as the following, this should work on AIR for Desktop, I believe Flex mobile for Android would work but not iOS.
<?xml version="1.0" encoding="utf-8"?>
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
addedToStage="addedToStageHandler(event)">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
protected var stageWebView:StageWebView;
protected function addedToStageHandler(event:Event):void
{
stageWebView = new StageWebView();
stageWebView.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
stageWebView.stage = stage;
stageWebView.loadURL("http://maps.google.com/");
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
if (stageWebView)
stageWebView.viewPort = new Rectangle(0, 0, unscaledWidth, unscaledHeight);
}
]]>
</fx:Script>
</s:WindowedApplication>
Google Maps V3 APIs are not supported by Flash / Flex. StageWebView or overlaying an HTML wrapper on top of your Flex app accessed via External Interface are options.
Natively, you may want to look for other map APIs such as MapQuest or Esri / ArcGIS.
Upvotes: 1