0
我正在AS3製作一個應用程序。我正在顯示Google地圖,我想在座標點添加子項(文本,形狀)。 所以,如果你移動地圖,孩子們會留在他們的座標點。在一個確切座標上添加一個小孩
這裏是我的代碼現在:
我怎麼能在一個確切的座標點加一個孩子?
像:
var myChild:MovieClip;
myChild= new drawShape;
addChild(myChild);
myChild(-22.2758000, 166.4580000);
(?但編碼是錯誤的,你知道我怎麼能做到這一點)
THX!
我的代碼:
import com.google.maps.LatLng;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.google.maps.MapMouseEvent;
import com.google.maps.overlays.Marker;
import com.google.maps.LatLng;
import flash.geom.Rectangle;
import com.google.maps.MapMouseEvent;
import com.google.maps.overlays.Polyline;
import com.google.maps.overlays.PolylineOptions;
import com.google.maps.styles.StrokeStyle;
import com.google.maps.controls.NavigationControl;
import com.google.maps.controls.MapTypeControl;
import com.google.maps.controls.OverviewMapControl;
var my_map:Map = new Map();
my_map.key = "AIzaSyCxiPVh482UPJ-cM6uBg5Fd88mTjxmQNV0";
my_map.sensor = "true";
addChild(my_map);
my_map.setSize(new Point(1203, 800));
my_map.addEventListener(MapEvent.MAP_READY, onMapReady);
function onMapReady(event:Event):void {
my_map.setCenter(new LatLng(-22.2758000,166.4580000), 15, MapType.NORMAL_MAP_TYPE);
var my_marker1:Marker = new Marker(new LatLng(-22.2758000,166.4580000));
my_map.addOverlay(my_marker1);
my_map.addControl(new MapTypeControl());
my_map.addControl(new OverviewMapControl());
my_map.addControl(new NavigationControl());
var polyline:Polyline = new Polyline([
new LatLng(-22.2758000, 166.4580000),
new LatLng(-22.2760383, 166.4687288),
new LatLng(-22.2683338, 166.4687288),
new LatLng(-22.2675395, 166.4572275),
new LatLng(-22.2758000, 166.4580000)],
new PolylineOptions({strokeStyle: new StrokeStyle({
color: 0xFF0000,
thickness: 4,
alpha: 0.7}) }));
polyline.addEventListener(MapMouseEvent.CLICK, polylineClickHandler);
my_map.addOverlay(polyline);
}
function polylineClickHandler(event:MapMouseEvent):void{
trace("polyline clicked.");
}
謝謝。當你說API不再可用時,它們是否會禁用它(應用程序將不再工作),或者這意味着我們將無法使用API創建其他應用程序? – user2421975