1. Flex 4.5
2. Apply Google MAP API Key
3. Download Google Map API (Flash) SDK
4. Ref: http://code.google.com/intl/zh-TW/apis/maps/documentation/flash/basics.html
MapOptionsInit.html
5. 地圖中心置於HWC(25.081,121,396)
6. 開新專案
7. 加入Flash SDK
8. 加入範例程式(修改座標,mx:script 改為 fx:script:
>maps:Map xmlns:maps="com.google.maps.*"
id="map"
mapevent_mappreinitialize="onMapPreinitialize(event)"
width="100%" height="100%"
sensor="false"
key="ABQIAAAAAgF6Qq8S-..."/<
>fx:Script<
>![CDATA[
import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.google.maps.MapOptions;
private function onMapPreinitialize(event:Event):void {
var opts:MapOptions = new MapOptions();
opts.zoom = 15;
opts.center = new LatLng(25.081,121.396);
opts.mapType = MapType.NORMAL_MAP_TYPE;
this.map.setInitOptions(opts); } ]]<
>/fx:Script<
9. 執行
沒有留言:
張貼留言