Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Actionscript 3 检查AS3中是否禁用了地理定位_Actionscript 3_Air_Geolocation - Fatal编程技术网

Actionscript 3 检查AS3中是否禁用了地理定位

Actionscript 3 检查AS3中是否禁用了地理定位,actionscript-3,air,geolocation,Actionscript 3,Air,Geolocation,我的AIR应用程序中有以下代码: if (Geolocation.isSupported){ var my_geo:Geolocation = new Geolocation(); my_geo.addEventListener(GeolocationEvent.UPDATE, onGeoUpdate); }else{ trace("Geolocation is not supported"); } 但如何检查GPS是否完全关闭 我想要一些像: if (Geolocation.isSu

我的AIR应用程序中有以下代码:

if (Geolocation.isSupported){
var my_geo:Geolocation = new Geolocation();
my_geo.addEventListener(GeolocationEvent.UPDATE, onGeoUpdate);
}else{
    trace("Geolocation is not supported");
}
但如何检查GPS是否完全关闭

我想要一些像:

if (Geolocation.isSupported){
var my_geo:Geolocation = new Geolocation();
my_geo.addEventListener(GeolocationEvent.UPDATE, onGeoUpdate);
}
if Geolocation.isOff){
trace("Your GPS is off");
}
谢谢你的帮助 否则{ 不支持跟踪定位;
}您可以使用Geolocation.muted

if (Geolocation.isSupported){
    var my_geo:Geolocation = new Geolocation();
    if (my_geo.muted){
        trace("Your GPS is off");
    }
    my_geo.addEventListener(GeolocationEvent.UPDATE, onGeoUpdate);
}else{
    trace("Geolocation is not supported");
}

首先检查Geolocation属性是否为true或false,以确定是否可以关闭对Geolocation服务的访问,或者用户是否可以拒绝对应用程序的访问

i、 e:

如果muted为false,则它处于启用状态,然后添加一个事件处理程序来跟踪它在应用程序使用geo服务期间是否关闭,从而使muted变为true,以便应用程序可以通知用户,或者在geo服务不可用时通知您需要做的任何事情

i、 e

if (my_geo.muted) { }
if (!my_geo.muted) { 
   // start listening for geo updates
   my_geo.addEventListener(GeolocationEvent.UPDATE, onGeoUpdate); 
}
// Listen for changes in the status of the geo service
my_geo.addEventListener(StatusEvent.STATUS, yourGEOServiceUpdateHandler);

    public function yourGEOServiceUpdateHandler(event:StatusEvent):void 
    { 
        if (my_geo.muted)
            my_geo.removeEventListener(GeolocationEvent.UPDATE, onGeoUpdate);
        else
            my_geo.addEventListener(GeolocationEvent.UPDATE, onGeoUpdate);
    }