Flex BuilderでGoogle Maps API for Flash [Google Maps]
Flex BuilderでGoogle Maps API for Flashのサンプルを
試してみることにしました。
Flex Builderで新しいFlexのプロジェクト(プロジェクト名は任意)を作ります。
ここでは、プロジェクト名はMapSimpleとしました。
下記URLからGoogle Maps API for Flash SDKをダウンロードします。
Google Maps API for Flash
http://code.google.com/intl/en/apis/maps/documentation/flash/index.html
解凍後、sdk/libs/にあるswcファイルをFlex Builderのプロジェクト内の
libsにコピーします。
libs/map_flex_1_1.swc(追記:2008年8月現在 map_flex_1_5.swc)
以下にあるMapSimple.mxmlをFlex Builderでビルドします。
Google Maps API for Flash Example Code
http://code.google.com/p/gmaps-samples-flash/source/browse/trunk/samplecode/MapSimple.mxml
サンプルのMapSimple.mxmlの22〜25行目にGoogle Maps のAPI Keyを追加後、
このサンプルをビルドすると、Debugモードでサンプルを見ることができます。
このAPI Keyは、Webサーバで使用しているものを使用しました。
map.key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
public function startMap(event:Event):void {
map = new Map();
map.key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
map.addEventListener(MapEvent.MAP_READY, onMapReady);
mapContainer.addChild(map);
}
上記の事は、Developer GuideのObtaining a Maps API Keyにも書いてあるのですが、
ちょっと例を置いてもらえるとわかりやすいのではと思いました。
Google Maps API for Flash Developer Guide
http://code.google.com/intl/en/apis/maps/documentation/flash/intro.html
Obtaining a Maps API Key
http://code.google.com/intl/en/apis/maps/documentation/flash/intro.html#API_Key
試してみることにしました。
Flex Builderで新しいFlexのプロジェクト(プロジェクト名は任意)を作ります。
ここでは、プロジェクト名はMapSimpleとしました。
下記URLからGoogle Maps API for Flash SDKをダウンロードします。
Google Maps API for Flash
http://code.google.com/intl/en/apis/maps/documentation/flash/index.html
解凍後、sdk/libs/にあるswcファイルをFlex Builderのプロジェクト内の
libsにコピーします。
libs/map_flex_1_1.swc(追記:2008年8月現在 map_flex_1_5.swc)
以下にあるMapSimple.mxmlをFlex Builderでビルドします。
Google Maps API for Flash Example Code
http://code.google.com/p/gmaps-samples-flash/source/browse/trunk/samplecode/MapSimple.mxml
サンプルのMapSimple.mxmlの22〜25行目にGoogle Maps のAPI Keyを追加後、
このサンプルをビルドすると、Debugモードでサンプルを見ることができます。
このAPI Keyは、Webサーバで使用しているものを使用しました。
map.key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
public function startMap(event:Event):void {
map = new Map();
map.key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
map.addEventListener(MapEvent.MAP_READY, onMapReady);
mapContainer.addChild(map);
}
上記の事は、Developer GuideのObtaining a Maps API Keyにも書いてあるのですが、
ちょっと例を置いてもらえるとわかりやすいのではと思いました。
Google Maps API for Flash Developer Guide
http://code.google.com/intl/en/apis/maps/documentation/flash/intro.html
Obtaining a Maps API Key
http://code.google.com/intl/en/apis/maps/documentation/flash/intro.html#API_Key
2008-05-20 18:08
nice!(0)
コメント(6)
トラックバック(0)
flex builder google mapで検索して来ました。
わかりやすくためになりました。
by みどり (2008-05-22 05:19)
みどりさん、初めまして。
ありがとうございます。
そう言っていただけて、何よりです。(^^
by ofuku (2008-05-22 23:00)
すごくお世話になりました。ありがとうございました!
最初、flexBuilderてなに!!て感じだったんですけど、
学生は、タダなんですねー。うれしいかぎりです。
by ぞう (2008-08-18 09:10)
ぞうさん、初めまして。
ありがとうございます。
記事がお役に立てて良かったです。
Flex勉強会というのもありますので、良かったら
見てみてくださいね。
FxUG
http://www.fxug.net/
by ofuku (2008-08-20 01:36)
いろんなとこ旅してやっと出会えました。ほんとにわかりやすかったです。一度ビルドないとだめなんですね。もくもくと作って、もくもくとドツボにハマってました。
by imap (2008-08-20 15:39)
imapさん、初めまして。
ありがとうございます。
お役に立てて良かったです。
もしFlexやGoogle Mapsでお困りの際は、FlexUGや
Google-Maps-API-Japan のようなコミュニティもあるので、
良かったら見てみてくださいね。
FxUG
http://www.fxug.net/
Google-Maps-API-Japan
http://groups.google.com/group/Google-Maps-API-Japan
by ofuku (2008-08-25 02:20)