13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 46: Communicating with native<br />

processes in AIR<br />

Adobe AIR 2 and later<br />

As of Adobe AIR 2, AIR applications can run and communicate with other native processes via the command line. For<br />

example, an AIR application can run a process and communicate with it via the standard input and output streams.<br />

To communicate with native processes, package an AIR application to be installed via a native installer. The file type<br />

of native installer is specific to the operating system for which it is created:<br />

It is a DMG file on Mac OS.<br />

It is an EXE file on Windows.<br />

It is an RPM or DEB package on Linux.<br />

These applications are known as ext<strong>en</strong>ded desktop profile applications. You can create a native installer file by<br />

specifying the -target native option wh<strong>en</strong> calling the -package command using ADT.<br />

More Help topics<br />

flash.filesystem.File.op<strong>en</strong>WithDefaultApplication()<br />

flash.desktop.NativeProcess<br />

Overview of native process communications<br />

Adobe AIR 2 and later<br />

An AIR application in the ext<strong>en</strong>ded desktop profile can execute a file, as if it were invoked by the command line. It can<br />

communicate with the standard streams of the native process. Standard streams include the standard input stream<br />

(stdin), the output stream (stdout), the standard error stream (stderr).<br />

Note: Applications in the ext<strong>en</strong>ded desktop profile can also launch files and applications using the<br />

File.op<strong>en</strong>WithDefaultApplication() method. However, using this method does not provide the AIR application<br />

with access to the standard streams. For more information, see “Op<strong>en</strong>ing files with the default system application” on<br />

page 680<br />

The following code sample shows how to launch a test.exe application in the application directory. The application<br />

passes the argum<strong>en</strong>t "hello" as a command-line argum<strong>en</strong>t, and it adds an ev<strong>en</strong>t list<strong>en</strong>er to the process’s standard<br />

output stream:<br />

Last updated 6/6/2012<br />

836

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!