Adobe AIR 执行程序 [英] Adobe AIR to execute program

查看:37
本文介绍了Adobe AIR 执行程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从 Adob​​e AIR 应用程序中按下一个按钮并执行一些已安装的程序.例如,我会有一个名为启动 Winamp"的按钮.当按下它时,它应该直接启动 Winamp.exe...我不想执行某些命令行,我只想启动一个 exe.或者……是一样的吗?请让我知道这是否可行.

I would like to press a button from an Adobe AIR application and execute some installed program. For example, I would have a button named "Start Winamp". When this is pressed it should start Winamp.exe directly...I don't want some command line thing executed, I only want an exe to start. Or...is it the same thing ? Please, let me know if this is possible.

谢谢.

推荐答案

没有直接的方法.试试 CommandProxy.

There's no direct way of doing it. Try CommandProxy.

仔细阅读博文.您确实需要创建两个不同的项目:本机操作系统可执行文件和 AIR 应用程序.本机可执行文件会启动您的 AIR 应用程序.AIR 应用程序反过来请求可执行文件来处理操作系统级别的请求.

Read the blog post very carefully. You really need to create two different projects: a native OS executable and an AIR app. The native executable fires up your AIR application. The AIR application in turn requests for the executable to process OS-level requests.

Google Code 下载源代码并创建两个项目——一个 Visual Studio/Mono用于示例 C# exe 和另一个 - 用于 AIR 应用程序.这里是描述如何设置前者的链接.

Download the source from Google Code and create two projects -- a Visual Studio/Mono for the sample C# exe and another -- for the AIR application. Here is a link that describes how to set up the former.

在您的 AIR 应用程序的主 MXML 文件中,您需要执行以下操作:

In your AIR app's main MXML file, you need to do the following:

  • 创建一个CommandProxy对象,添加几个事件监听器,用于连接检测,以及Command响应和错误.

  • Create a CommandProxy object, add a few event listeners, for connection detection, and Command response and error.

通过connect调用连接到本地exe

Connect to the native exe via a connect call

connect 的事件处理程序中,创建一个新的 Command,例如ScreenshotCommand 并执行它(通过 CommandProxy.execute 方法)

In the event handler for connect, create a new Command e.g. ScreenshotCommand and execute it (via CommandProxy.execute method)

...就是这样!

希望这会有所帮助.

这篇关于Adobe AIR 执行程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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