Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 带有谷歌地图API的ActionScript3:如何制作交互式覆盖_Actionscript 3_Google Maps_Google Maps Api 3 - Fatal编程技术网

Actionscript 3 带有谷歌地图API的ActionScript3:如何制作交互式覆盖

Actionscript 3 带有谷歌地图API的ActionScript3:如何制作交互式覆盖,actionscript-3,google-maps,google-maps-api-3,Actionscript 3,Google Maps,Google Maps Api 3,我有一个谷歌地图在我的Flash项目与多边形覆盖 是否可以向该覆盖添加EventListener以触发函数 我在API参考中只能找到一个名为“MapMouseEvent”的东西,但我不知道这是我需要的还是它是如何工作的。您可以使用Google Maps API中的MapMouseEvents 下面是一个使用Google的多段线代码,然后添加鼠标单击事件侦听器的示例: package { import com.google.maps.LatLng; import com.googl

我有一个谷歌地图在我的Flash项目与多边形覆盖

是否可以向该覆盖添加EventListener以触发函数


我在API参考中只能找到一个名为“MapMouseEvent”的东西,但我不知道这是我需要的还是它是如何工作的。

您可以使用Google Maps API中的MapMouseEvents

下面是一个使用Google的多段线代码,然后添加鼠标单击事件侦听器的示例:

package { import com.google.maps.LatLng; import com.google.maps.Map; import com.google.maps.MapEvent; import com.google.maps.MapMouseEvent; import com.google.maps.MapType; import com.google.maps.overlays.Polyline; import com.google.maps.overlays.PolylineOptions; import com.google.maps.styles.StrokeStyle; import flash.display.Sprite; import flash.geom.Point; public class Test extends Sprite { private var map:Map; public function Test() { map = new Map(); map.key = "YOUR_API_KEY"; map.sensor = "false"; map.setSize(new Point(stage.stageWidth, stage.stageHeight)); addChild(map); map.addEventListener(MapEvent.MAP_READY, mapReadyHandler); } public function mapReadyHandler(event:MapEvent):void { map.setCenter(new LatLng(37.4419, -122.1419), 13, MapType.NORMAL_MAP_TYPE); var polyline:Polyline = new Polyline([ new LatLng(37.4419, -122.1419), new LatLng(37.4519, -122.1519) ], new PolylineOptions({strokeStyle: new StrokeStyle({ color: 0xFF0000, thickness: 4, alpha: 0.7}) })); polyline.addEventListener(MapMouseEvent.CLICK, polylineClickHandler); map.addOverlay(polyline); } protected function polylineClickHandler(event:MapMouseEvent):void { trace("polyline clicked."); } } } 包裹 { 导入com.google.maps.LatLng; 导入com.google.maps.Map; 导入com.google.maps.MapEvent; 导入com.google.maps.MapMouseEvent; 导入com.google.maps.MapType; 导入com.google.maps.overlays.Polyline; 导入com.google.maps.overlays.PolylineOptions; 导入com.google.maps.style.StrokeStyle; 导入flash.display.Sprite; 导入flash.geom.Point; 公共类测试扩展了Sprite { 私有var映射:map; 公共功能测试() { map=新map(); map.key=“您的API\u密钥”; map.sensor=“false”; map.setSize(新点(stage.stageWidth,stage.stageHeight)); addChild(map); map.addEventListener(MapEvent.map_READY,mapReadyHandler); } 公共函数mapReadyHandler(事件:MapEvent):无效 { 地图设置中心(新LatLng(37.4419,-122.1419),13,地图类型。普通地图类型); 变量多段线:多段线=新多段线([ 新车床(37.4419,-122.1419), 新车床(37.4519,-122.1519) ],新的多段线选项({strokeStyle:new strokeStyle({ 颜色:0xFF0000, 厚度:4, α:0.7}) })); polyline.addEventListener(MapMouseeEvent.CLICK,polylineClickHandler); map.addOverlay(多段线); } 受保护的函数polylineClickHandler(事件:MapMouseeEvent):void { 跟踪(“单击多段线”); } } }