谷歌有deprecated the Google Maps Flash APIs in late 2011。
“因此,我们决定在
为了将我们的注意力集中在 JavaScript Maps API v3 上
向前。这意味着虽然 Maps API for Flash 应用程序将
继续按照给定的弃用政策运行
在 Maps API 服务条款中,不会开发新功能,
并且只有严重的错误、回归和安全问题将是
固定的。我们将继续为现有的 Google Maps API 提供支持
使用 Maps API for Flash 的高级客户,但将逐渐减少
开发者关系参与 Maps API for Flash 论坛。”
因此 - 如果您还不是现有的 Google Maps API Premier 客户 - 您将无法使用 Google Maps OpenLaszlo component in the incubator。您应该改用Google JavaScript Maps API v3。可以在 SWF 运行时中使用<html /> tag 集成地图对象。如果您只打算使用 DHTML 运行时,您可以将地图对象直接附加到视图的显示对象。
由于当前版本的 OpenMeetings 似乎仍然使用 SWF 运行时作为默认目标运行时,因此您可以选择通过 <html src="" /> 标记使用 iFrame。
这是一个基于您在评论中的代码的简单示例。该示例使用两个文件:一个 LZX 文件和一个包含 Google 地图示例的 HTML 文件。这是LZX代码:
<canvas height="500">
<class name="showGISWindow"
extends="view"
width="464" height="440">
<method name="setLatLong" args="lat,lng">
this.maps.callJavascript('centerMap(' + lat + ', ' + lng + ')' );
</method>
<button text="Show New York"
align="center"
onclick="parent.setLatLong(40.69847032728747, -73.9514422416687)" />
<html name="maps" src="gmaps.html"
x="15" y="45"
width="${parent.width - 30}"
height="${parent.height - 45}" />
</class>
<showGISWindow id="gis" x="10" y="10" />
</canvas>
以及对应的gmaps.html页面内容,加载到iFrame中:
<!DOCTYPE html>
<html>
<head>
<title>Google Maps JavaScript API v3 Example: Map Simple</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
html, body, #map_canvas {
margin: 0;
padding: 0;
height: 100%;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
var map;
function initialize() {
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map_canvas'),
mapOptions);
}
function centerMap(lat, lng) {
map.setCenter(new google.maps.LatLng(lat, lng));
map.setZoom(11);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map_canvas"></div>
</body>
</html>
单击按钮时,OpenLaszlo 应用程序会调用 HTML 页面中的函数 centerMap(lat, lng),并将地图居中到纽约。这是 SWF10 运行时中应用程序的屏幕截图: