如何检查是否一个SWF正在作为一个AIR应用程序? [英] How to check if a SWF is running as an AIR app?

查看:149
本文介绍了如何检查是否一个SWF正在作为一个AIR应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道是否有一种方法为SWF以检查在运行时是否正在运行一个在线的SWF或AIR应用程序?我需要使用相同的SWF运行在线和本地,但作为一个AIR应用程序运行的时候,外部资产位于不同的目录。我想检查的SWF是本地的还是在线这样我就可以改变对外资产相应的源路径。

I'm wondering if there is a way for a SWF to check at runtime whether it is running as an online SWF or an AIR app? I need to use the same SWF to run both online and locally, however when running as an AIR app, external assets are located in a different directory. I'd like to check whether a SWF is local or online so I can change the source path for external assets accordingly.

谢谢, 桑德罗

编辑:我刚刚意识到这可能是一个愚蠢的问题。 :)我可能只是使用Flash变量来告诉它是在一个AIR应用程序运行的SWF。

I just realized this might be a dumb question. :) I may just use flashvars to tell the SWF that it is running within an AIR app.

推荐答案

您可以使用的 <一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Capabilities.html#playerType">Capabilities类。

You can use the Capabilities class.

import flash.system.Capabilities;

switch (Capabilities.playerType) {
    case 'Desktop':
        //air runtime
        break;
    case 'PlugIn':
    case 'ActiveX':
        //browser
        break;
}

这是Adobe的<一个更多信息href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Capabilities.html#playerType">ActionScript 3参考。

这篇关于如何检查是否一个SWF正在作为一个AIR应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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