AS3:根据 Flash Player 版本启用功能

发布于 2024-10-07 02:52:09 字数 508 浏览 0 评论 0原文

我想知道是否可以根据 ActionScript 3 中的 Flash Player 版本启用/禁用某些代码

。我有一个使用 flash.media.Microphone 的自定义类 customClass。 Microphone 类有一个属性 isSupported,该属性适用于 Flash Player 版本 10.1 及更高版本(如文档中所述)。我在我的 customClass 中实现了这个属性...所以:

我需要这样的东西(通过检查内置的 Capability.version ):

if (version >= 10.1) {
    trace(_mic.isSupported); //this will throw an error if the debug version is not 10.1 or later
} else { 
    doSmthElse();
}

有没有办法做到这一点?

I'd like to know if it is possible to enable/disable some piece of code according to Flash Player version in ActionScript 3.

Let's say; I have a custom class customClass that uses flash.media.Microphone. The Microphone class has a property isSupported which is available for Flash Player version 10.1 and above (as stated in the documentation). I implement this property in my customClass... so:

I need something like this (by checking with the built-in Capabilities.version):

if (version >= 10.1) {
    trace(_mic.isSupported); //this will throw an error if the debug version is not 10.1 or later
} else { 
    doSmthElse();
}

is there a way to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

阳光下慵懒的猫 2024-10-14 02:52:09

这是我知道的唯一方法:

if (version >= 10.1) {
    trace(_mic["isSupported"]); //this will throw an error if the debug version is not 10.1 or later
} else { 
    doSmthElse();
}

使用括号访问语法,验证程序不会尝试检查方法或属性是否提前定义(我认为是在加载时)。因此,您的代码只有在实际运行时才会在运行时进行评估。

This is the only way I know:

if (version >= 10.1) {
    trace(_mic["isSupported"]); //this will throw an error if the debug version is not 10.1 or later
} else { 
    doSmthElse();
}

With the bracket access syntaxt the verifier won't try to check whether the method or property is defined in advance (at load time, I think). So your code will only be evaluated at runtime, if it actually runs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文