multimedia design, Actionscript, Lingo, PHP, Perl, SQL
1月
3
Post

Google Maps API for Flash は現在 Version 1.8c。
コンポーネントが提供され、とっても簡単に Flash / Flex で Google Map が作成できる。

Google Maps API for Flash SDK をダウンロードし Setup Instructions の説明通りコンポーネント(swc)を配置する。
Tutorial に詳しく書かれている。

Flashではコンポーネント・パレットから GoogleMapsLibrary をステージへ適当にドラッグしあとは Actionscript で地図を作成。

Google Map API for Flash

Google Map API for Flash


import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.google.maps.Color;
import com.google.maps.controls.*;
import com.google.maps.styles.*;
 
// start create map
var map:Map = new Map();
// set Google Map API key
map.key = "your API key";
// Map size
map.setSize(new Point(stage.stageWidth, stage.stageHeight));
// set MAP_READY handler
map.addEventListener(MapEvent.MAP_READY, onMapReady);
// set language -- defalut is English
map.language = "ja";
// set Maptype Control
map.addControl(new MapTypeControl());
// set Navigation Control -- zoom / move
map.addControl(new NavigationControl());
// Overview Control style
var cpOption:Object = {
		controlStyle:{
		bevelStyle: BevelStyle.BEVEL_NONE
		,strokeStyle: {color: Color.GRAY10,alpha: 1.0,thickness: 1.0}
		}
		,padding:{x:0,y:0}
		,position: new ControlPosition(ControlPosition.ANCHOR_BOTTOM_RIGHT)
		,size: {x: 100*stage.stageWidth/stage.stageHeight,y: 100}
	};
// set Overview Control
map.addControl(new OverviewMapControl(new OverviewMapControlOptions(cpOption)));
// display
this.addChild(map);
// method of MAP_READY handler
function onMapReady(event:Event):void {
  map.setCenter(new LatLng(33.590832,130.401042), 14, MapType.NORMAL_MAP_TYPE);
}

Google Maps API for Flash Developer Guide
Languages

Bookmark and Share

コメントをどうぞ

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

*

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <img localsrc="" alt=""> <pre lang="" line="" escaped="">