可选择使用 Flash 10.2 光标,同时仍与 Flash 10.0 兼容? [英] Optionally use Flash 10.2 cursors, while still being compatible with Flash 10.0?

查看:12
本文介绍了可选择使用 Flash 10.2 光标,同时仍与 Flash 10.0 兼容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个需要 Flash 10.0 版才能运行的 Flash 应用程序.我想添加原生鼠标光标,这是在 Flash 10.2 中引入的,但我不想要求我的所有用户都升级,而且我不想编译我的应用程序的两个单独版本.

I have a Flash application that requires Flash version 10.0 to run. I want to add native mouse cursors, which were introduced in Flash 10.2, but I don't want to require all my users to upgrade, and I don't want to have to compile two separate versions of my app.

有什么方法可以在运行时检测游标是否可用,然后使用它们?

Is there any way at runtime I can detect if the cursors are available, and then use them?

似乎如果您只针对 Flash 10.0 进行编译,它会将 SWF 版本标头标记为10",并且您无法访问新的 API.如果您为 Flash 10.2 编译,它会将版本标头标记为11",并且您可以访问新的 API,但不能再在旧的 Flash 播放器中运行(我在加载 Flex 框架时遇到了疯狂的错误,例如:

It seems like if you only compile for Flash 10.0, it marks the SWF version header "10", and you have no access to the new APIs. And if you compile for Flash 10.2, it marks the version header "11", and you have access to the new APIs, but can't run in the old Flash player any more (I get crazy errors while it's loading the Flex framework like:

VerifyError: Error #1053: Illegal override of play2 in org.osmf.net.dynamicstreaming.DynamicNetStream.

ReferenceError: Error #1065: Variable _379fa43169660c76f131cadc0adfbfe8f347bd31d3ceec26a9cb2a56f0dda1f9_flash_display_Sprite is not defined.

推荐答案

if (Mouse["supportsNativeCursor"]) 
{
  // do stuff with MouseCursorData...
}

注意事项:

  • 这相当于调用属性Mouse.supportsNativeCursor,但由于supportsNativeCursor 在 10.2 之前不受支持,因此您需要像这样检查属性
  • 有些设备可能不支持光标,即使它们有 10.2(Android 平板电脑没有光标)——所以也要注意这一点!
  • 您可能希望将其设置为布尔值,因为对其进行评估可能会影响性能
  • This is equivalent to calling the property Mouse.supportsNativeCursor, but since supportsNativeCursor isn't supported either prior to 10.2 you need to check the property like this
  • Some devices may not support cursors even if they have 10.2 (Android tablets don't have cursors) -- so be aware of that too!
  • You may want to set this to a boolean because evaluating it probably gives a performance hit

感谢此视频提供了此信息.跳到时间线中的大约 7:40 :

Thanks to this video for this information. Skip to about 7:40 in the timeline :

http://www.youtube.com/watch?v=rtc3DYSuahI&feature=player_embedded#at=464

本文附带的视频:http://everythingfla.com/quickies/native-mouse

基本上解决方法如下:

这篇关于可选择使用 Flash 10.2 光标,同时仍与 Flash 10.0 兼容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆