我已使用StageWebView在我的AIR应用中嵌入了此地图。
marinetraffic.com提供的javascript代码就是这个:
<script type="text/javascript">
width='100%'; // the width of the embedded map in pixels or percentage
height='450'; // the height of the embedded map in pixels or percentage
border='1'; // the width of the border around the map (zero means no border)
shownames='false'; // to display ship names on the map (true or false)
latitude='37.4460'; // the latitude of the center of the map, in decimal degrees
longitude='24.9467'; // the longitude of the center of the map, in decimal degrees
zoom='9'; // the zoom level of the map (values between 2 and 17)
maptype='3'; // use 0 for Normal map, 1 for Satellite, 2 for Hybrid, 3 for Terrain
trackvessel='0'; // MMSI of a vessel (note: vessel will displayed only if within range of the system) - overrides "zoom" option
fleet=''; // the registered email address of a user-defined fleet (user's default fleet is used)
remember='false'; // remember or not the last position of the map (true or false)
language='en'; // the preferred display language
showmenu=true; // show or hide the map options menu
</script>
<script type="text/javascript" src="http://www.marinetraffic.com/js/embed.js"></script>
是否可以在此地图上添加用户的当前位置?
如果是的话,我该怎么办?
(我已尝试在我的剧本中添加此内容:
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position) {
var pos = {
lat: position.coords.latitude,
lng: position.coords.longitude
};
infoWindow.setPosition(pos);
infoWindow.setContent('Location found.');
map.setCenter(pos);
}, function() {
handleLocationError(true, infoWindow, map.getCenter());
});
} else {
// Browser doesn't support Geolocation
handleLocationError(false, infoWindow, map.getCenter());
}
}
但它没有用)。
THX