为什么不支持AIR NativeProcess?

时间:2011-09-19 23:05:43

标签: flex actionscript air

我正在使用Flash Builder构建桌面应用程序,我需要它来运行.exe程序。我下载并安装了最新的AIR SDK,将它放在我的Flash Builder sdks文件夹中并让我的项目使用它。现在我没有任何编译器错误,但是:

     if(NativeProcess.isSupported)
            {
                var file:File = new File("C:\Torres.exe");
                var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
                nativeProcessStartupInfo.executable = file;
                var process:NativeProcess = new NativeProcess();
                process.start(nativeProcessStartupInfo);
            }

我检查了它,它永远不会进入if块。为什么不支持nativeprocess?有什么想法吗?

2 个答案:

答案 0 :(得分:12)

添加此

<supportedProfiles>extendedDesktop</supportedProfiles>

到您应用的清单文件中。使用NativeProcess需要扩展权限。

该文章可能会有所帮助:http://www.adobe.com/devnet/air/flex/articles/air_screenrecording.html

答案 1 :(得分:1)

的可能性:

  1. 您的AIR Runtime不是2.0或更高版本。因为NativeProcess仅支持2.0及更高版本。

    您可以通过两种方式检查Adobe AIR运行时版本 a)手册
    b)通过编码

    a)手册

    • 在Windows中:开始 - &gt;设置 - &gt;控制面板 - &gt;添加或删除程序 - &gt;选择Adobe AIR - &gt;点击“点击此处获取支持信息”链接
    • 在MAC OSx中:Finder窗口 - &gt;选择应用程序 - &gt;选择Adobe AIR Installer - &gt;右键单击 - &gt;选择“获取信息”

    b)通过编码

    将此代码粘贴到桌面应用程序中以查找AIR运行时版本。

      

    迹(nativeApplication.runtimeVersion); // 2.6.0.19120

  2. 您在应用程序描述符文件的“supportedProfiles”属性中未提及的“extendedDesktop”值或您未启用该属性。

      

    &LT; supportedProfiles&GT; extendedDesktop&LT; / supportedProfiles&GT;