有人可以向我指出一个教程,该教程解释了如何在 Actionscript 3 的 Javascript 中使用 Google Maps API v3?我正在尝试自学,但到目前为止还没有运气。以下测试程序显示简单的 HTML,但不显示 Google 地图。
<?xml version="1.0" encoding="utf-8"?>
<!-- aircomponents/src/HTMLSimple.mxml -->
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<mx:ControlBar width="100%">
<s:Button label="< Back"
click="content.historyBack();"/>
<s:Button label="Forward >"
click="content.historyForward();"/>
<s:TextInput id="address"
text="{content.location}" width="100%"/>
<s:Button label="Go!"
click="content.location = address.text"/>
</mx:ControlBar>
<s:Group width="100%" height="100%">
<mx:HTML id="content" location="file:///C:/googlemaps.html"/>
</s:Group>
</s:WindowedApplication>
文件 C:/googlemaps.html 适用于 Firefox,包含:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0; padding: 0 }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDfNNCCL7xmvk-gTYmvS_Cy5PZcf5L3j_I&sensor=false">
</script>
<script type="text/javascript">
function initialize() {
var myOptions = {
center: new google.maps.LatLng(41., -96),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>