old_wang
old_wang
  • 发布:2015-10-28 17:14
  • 更新:2015-10-28 17:14
  • 阅读:1700

百度地图绘制折线时无法获取点的实例

分类:MUI

你好,我这边有一个关于异步的问题。 var point_hz = null;
var point_bj = null;
var point_sh = null;
plus.maps.Map.geocode("杭州", {
city: "杭州"
}, function(e) {
point_hz = new plus.maps.Point (JSON.stringify(e.coord));
alert(point_hz);
}, function(e) {
alert(JSON.stringify(e));
});
plus.maps.Map.geocode("北京", {
city: "北京"
}, function(e) {
point_bj = new plus.maps.Point (JSON.stringify(e.coord));
}, function(e) {
});
plus.maps.Map.geocode("上海", {
city: "上海"
}, function(e) {
point_sh = new plus.maps.Point (JSON.stringify(e.coord));
}, function(e) {
alert(JSON.stringify(e));
});
var polyLine = new plus.maps.Polyline(new Array(point_hz, point_bj, point_sh));
alert(point_bj);
polyLine.setLineWidth(2);
polyLine.setStrokeColor("#ff0000");
ptMap.addOverlay(polyLine);

这个方法中,在下方获取的3个点全是null值,有什么方法可以暂时关闭异步吗?

2015-10-28 17:14 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复