ReferenceError:错误#1065:变量 flash.sensors::Geolocation 未定义
我有一个浏览器应用程序,我想使用 Geolocation 类。问题是当我尝试使用 Geolocation.isSupported 时出现该错误。我已在文件中导入 flash.sensors.Geolocation
但仍然出现此错误。
有什么想法吗?谢谢
稍后编辑:
在我尝试了这样的操作后,我得到了这个错误:
public static function get isGeolocationSupported():Boolean
{
return Geolocation.isSupported;
}
并调用了这个函数。
但如果我直接调用 Geolocation.isSupported 我会收到此错误:
VerifyError:错误#1014:类 flash.sensors::Geolocation 无法 被发现。
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 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
此功能仅在移动设备上受支持。桌面或 AIR for TV 设备以及 Web 应用程序均不支持它。
This feature is supported only on mobile devices. It is not supported on desktop or AIR for TV devices neither on web applications.
如果您在发布 flash as3 swf 时收到此错误,那是因为您需要将您的类声明为公共类。私有类不能用作文档类,因为它们在类包之外,因此不属于私有范围的一部分。
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.
以下错误是由于未实例化 Geolocation 类造成的
例如:geo = new Geolocation();
另一个错误
是因为你没有导入类
The following error is due to not instantiating the Geolocation class
EX: geo = new Geolocation();
The other error
Is because you did not import the class
我尝试过:
但它给了我同样的错误 - 不幸的是在这种情况下,您将需要进行尝试/捕获。
I tried:
But it gave me the same error - you will need to do a try/catch, unfortunately in this situation.
也许我的回答来得太晚了,但我昨天收到了同样的错误,我可以安排它。您可以在 Adobe Device Central 中测试该应用程序,您可以在其中更改您正在使用的设备。实际上它在默认设备中不起作用。由于 Flash 版本的原因,我在尝试通过 swf 播放器在智能手机中使用该应用程序时也遇到了问题。我不得不将其更改为 10.1 或更低版本(支持地理位置的版本),无论如何我都无法使其正常工作,尽管它在 Device Central 上运行正常。
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.