开发者

ReferenceError: Error #1065: Variable flash.sensors::Geolocation is not defined

I have a browser application and i want to use the Geolocation class. The problem is that i get that error when i try to use Geolocation.isSupported. I have imported the flash.sensors.Geolocation in the file but still get this error.

Any ideas? Thank you

later 开发者_JAVA技巧edit:

i got that error after i tried something like this:

public static function get isGeolocationSupported():Boolean
        {
            return Geolocation.isSupported;
        }

and called this function.

but if i call directly Geolocation.isSupported i get this error:

VerifyError: Error #1014: Class flash.sensors::Geolocation could not be found.


This feature is supported only on mobile devices. It is not supported on desktop or AIR for TV devices neither on web applications.


If you are receiving this error when publishing your flash as3 swf it is because you need to declare your class as public. Private classes can not be used as document classes because they are out of the class package and therefore are not a part of the private scope.


The following error is due to not instantiating the Geolocation class
EX: geo = new Geolocation();

ReferenceError: Error #1065: Variable flash.sensors::Geolocation is not defined





The other error

VerifyError: Error #1014: Class flash.sensors::Geolocation could not be found.

Is because you did not import the class


I tried:

return (Geolocation != null);

But it gave me the same error - you will need to do a try/catch, unfortunately in this situation.

var result:Boolean = false;
try
{
    result = Geolocation.isSupported;
}
    catch (e:Error)
{
    trace(e.message);
}
finally
{
    return result;
}


Maybe my answer come too late, but I was receiving same error yesterday and I could arrange it. You can test the app in Adobe Device Central, where you can change the device you are using. Actually it doesn't work in the default device. I have had also problems when trying to use the app in my smartphone through a swf player, because of the flash version. I had to change it to 10.1 or lower versions (versions supporting Geolocation), and anyway I haven't been able to make it work well, though it was running ok on Device Central.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜