<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2008 Google Inc.
Licensed under the Apache License, Version 2.0:
http://www.apache.org/licenses/LICENSE-2.0
-->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:maps="com.google.maps.*"
layout="absolute"
width="100%"
height="100%"
viewSourceURL="srcview/index.html">
<mx:Panel title="Google Maps API for Flash Demo"
width="100%"
height="100%">
<maps:Map id="map"
key="ABQIAAAAtDJGVn6RztUmxjnX5hMzjRRe6jqCYhmMejXENq58KWrRXS3VMxT-muN3IObdGe-IHNb4lrnKS4HVYQ"
mapevent_mapready="onMapReady(event)"
width="100%"
height="100%"/>
</mx:Panel>
<mx:Script>
<![CDATA[
import com.google.maps.overlays.Marker;
import com.google.maps.MapEvent;
import com.google.maps.Map;
import com.google.maps.MapType;
import com.google.maps.LatLng;
import com.google.maps.overlays.MarkerOptions;
import com.google.maps.interfaces.IProjection;
import com.google.maps.styles.FillStyle;
import com.google.maps.styles.StrokeStyle;
import com.google.maps.overlays.PolygonOptions;
import com.google.maps.overlays.Polygon;
import com.google.maps.InfoWindowOptions;
import flash.events.Event;
import com.google.maps.MapEvent;
import com.google.maps.Map;
import com.google.maps.MapType;
import com.google.maps.LatLng;
import LineOverlayDemo.Constant;
private var locations:Array=Constant.locations;
private var currentLocation:int=0;
private var cloudOverlay:LineOverlay;
private var markers:Array=[];
private function onMapReady(event:Event):void
{
map.setCenter(new LatLng(31.17709,111.09375), 5, MapType.NORMAL_MAP_TYPE);
var latlngs:Array = new Array();
for(var i:uint=0; i < locations.length; i++)
{
var latlng:LatLng=new LatLng(Number(locations[i].lat), Number(locations[i].lng));
latlngs.push(latlng);
}
var polygonOptions:PolygonOptions = new PolygonOptions();
var fillStyle:FillStyle = new FillStyle();
fillStyle.alpha = 0.5;
fillStyle.color = "0xff0040";
polygonOptions.fillStyle = fillStyle;
//StrokeStyle 类用于为绘制图形对象的轮廓指定一组参数。
var strokeStyle:StrokeStyle = new StrokeStyle();
strokeStyle.alpha = 0.2; //透明度
strokeStyle.color = "0xffffff";
strokeStyle.thickness = 10; //用于指定笔触粗细
polygonOptions.strokeStyle = strokeStyle
var polygon:Polygon = new Polygon(latlngs, polygonOptions);
map.addOverlay(polygon);
}
]]>
</mx:Script>
</mx:Application>
//StrokeStyle 类用于为绘制图形对象的轮廓指定一组参数。
var strokeStyle:StrokeStyle = new StrokeStyle();
strokeStyle.alpha = 0.2; //透明度
strokeStyle.color = "0xffffff";
strokeStyle.thickness = 10; //用于指定笔触粗细
polygonOptions.strokeStyle = strokeStyle