从动作脚本库中检测 AIR 与 Flash Player [英] Detect AIR versus Flash Player from an actionscript library

查看:31
本文介绍了从动作脚本库中检测 AIR 与 Flash Player的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 swc,它的运行方式略有不同,具体取决于它是否由 AIR 托管.我在互联网上看到了两个建议:

I have an swc which needs to operate slightly differently depending on whether it is being hosted by AIR or not. I've seen two suggestions on the internet:

  • 为 WindowedApplication 测试 Application.application.
  • 测试 Security.sandboxType 的 Security.APPLICATION.

但是,这些在我的 .swc 中似乎不起作用,因为编译器找不到 WindowedApplication 或 Security.APPLICATION.我的库不需要任何其他 AIR 功能,因此我认为它没有链接到 AIR 库,而且我认为不应该链接到它以便它继续在 Flash Player 中工作.

However, these don't seem to work in my .swc as the compiler can't find WindowedApplication or Security.APPLICATION. My library doesn't need any other AIR features so I assume it's not being linked to the AIR libraries, and I assume shouldn't be in order that it continues to work in flash player.

有什么建议吗?

推荐答案

您可以使用 flash.system.Capabilities 对象以确定您是否在 AIR 下运行.

You can use the flash.system.Capabilities object to find out if you running under AIR.

var isAir : Boolean = (Capabilities.playerType == "Desktop");
var isFlashPlayer : Boolean = (Capabilities.playerType == "StandAlone");
var isBrowser : Boolean = (Capabilities.playerType == "ActiveX" || Capabilities.playerType == "PlugIn");
var isOther : Boolean = (Capabilities.playerType == "External");

这篇关于从动作脚本库中检测 AIR 与 Flash Player的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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