AS3:根据 Flash Player 版本启用功能
我想知道是否可以根据 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我知道的唯一方法:
使用括号访问语法,验证程序不会尝试检查方法或属性是否提前定义(我认为是在加载时)。因此,您的代码只有在实际运行时才会在运行时进行评估。
This is the only way I know:
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.