确保浏览器 AS3 支持节流

Ensure that throttling is supported in browser AS3

如何确保当前使用的浏览器支持ThrottleEvent

我看到他们提到了一些支持它的浏览器:

The platforms that support throttling and pausing are currently the following: Flash Player Desktop Mac and Windows, AIR Mobile, and Flash Player Android. The following platforms do not dispatch the ThrottleEvent automatically because they do not yet support pausing or throttling: AIR for TV devices, AIR for desktop, and Flash Player Linux Desktop.

但我不认为我可以具体检查每一个(我想也有边缘情况)。

我想做这样的事情:

package
{
    import flash.display.MovieClip;
    import flash.external.ExternalInterface;
    import flash.events.ThrottleEvent;
    import flash.events.ThrottleType;

    public class TestThrottle extends MovieClip
    {
        public function TestThrottle()
        {
            var throttlingIsEnabled = ???
            ExternalInterface.call('throttlingSupported', throttlingIsEnabled);
        }
    }
}

你知道我如何实现这一点吗?

正如您在问题中提到的:

The platforms that support throttling and pausing are currently the following: Flash Player Desktop Mac and Windows, AIR Mobile, and Flash Player Android. ...

因为您正在为 Flash Player 编写代码,所以您只需验证它是 Flash Player Desktop Mac 还是 Windows 以了解是否支持节流和暂停,并且您可以验证使用 flash.system.Capabilities especially Capabilities.version, Capabilities.os and Capabilities.playerType.

希望能帮到你。