Adobe AIR to execute program

后端 未结 10 2190
陌清茗
陌清茗 2020-12-01 00:28

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 pres

10条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-01 00:53

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

    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.

    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.

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

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

    • Connect to the native exe via a connect call

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

    ... and that's it!

    Hope this helps.

提交回复
热议问题