Actionscript 3 在精确的坐标点处添加子对象
我正在AS3中制作一个应用程序。我正在显示谷歌地图,我想在坐标点添加子元素(文本、形状)。 因此,如果你移动地图,孩子们将停留在他们的坐标点上 以下是我目前的代码: 如何在精确的坐标点添加子对象 比如:Actionscript 3 在精确的坐标点处添加子对象,actionscript-3,google-maps,addchild,Actionscript 3,Google Maps,Addchild,我正在AS3中制作一个应用程序。我正在显示谷歌地图,我想在坐标点添加子元素(文本、形状)。 因此,如果你移动地图,孩子们将停留在他们的坐标点上 以下是我目前的代码: 如何在精确的坐标点添加子对象 比如: var myChild:MovieClip; myChild= new drawShape; addChild(myChild); myChild(-22.2758000, 166.4580000); (但是代码错了。你知道我怎么做吗?) 谢谢 我的代码: import com.google
var myChild:MovieClip;
myChild= new drawShape;
addChild(myChild);
myChild(-22.2758000, 166.4580000);
(但是代码错了。你知道我怎么做吗?)
谢谢
我的代码:
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.");
}
是和否。你不能简单地在地图上添加你想要的对象。但您可以通过标记来模拟添加自定义对象。标记具有
图标
属性:
var markerOptions:MarkerOptions = new MarkerOptions();
markerOptions.icon = new PersonalShape();
markerOptions.iconAlignment = MarkerOptions.ALIGN_VERTICAL_CENTER;
var marker:Marker = new Marker(new LatLng(-22.2758000,166.4580000), markerOptions);
map.addOverlay(marker);
我有个坏消息要告诉你:
API将继续工作到2014年9月2日。在该日期之后,API将不再可用
谢谢当你说API将不再可用时,他们会禁用它(应用程序将不再工作),还是意味着我们将无法使用API创建其他应用程序?