if(Geolocation.supported)
{
Geolocation.enableHighAccuracy = true;
Geolocation.getCurrentPosition(Handler.create(this,function(pos):void
{
alert("pos:"+pos.coords.longitude+","+pos.coords.latitude);
}),Handler.create(this,function(error):void
{
switch (error.code)
{
case Geolocation.PERMISSION_DENIED:
alert("位置服务被拒绝,请检查您的GPS和定位设置");
break;
case Geolocation.POSITION_UNAVAILABLE:
alert("暂时获取不到位置信息");
break;
case Geolocation.TIMEOUT:
alert("获取位置信息超时");
break;
default:
alert("加载地图时出现未知错误");
break;
}
}));
}else
alert("不支持");
为毛获取不到