120 likes | 254 Views
NativeProcess. By, Jonathan Rowny. The power to process (other applications). Jonathan Rowny. @ jrowny Jrowny.com jrowny@aboutweb.com jrowny@gmail.com Google Plus, +Jonathan Rowny. The Plan. Overview Support Setting up your Project The basics Compiling Example #1 Check Yo Self
E N D
NativeProcess By, Jonathan Rowny The power to process (other applications)
Jonathan Rowny • @jrowny • Jrowny.com • jrowny@aboutweb.com • jrowny@gmail.com • Google Plus, +Jonathan Rowny
The Plan • Overview • Support • Setting up your Project • The basics • Compiling • Example #1 Check YoSelf • Example #2 SSH into a remote server • Example #3 Drinking Bird • Q&A
What’s the NativeProcess? • Allows you to call other applications • Behind the scenes • Send/Receive input and output through "processes" • a.k.aStandard In, Standard Out • a.k.a text. • NOT the same thing as NativeExtensions
Support • Works on Mac, Linux, and Windows • Assumes Native Apps Exist • Linux goes unsupported after Air 2.5 :( • Introduced in Air 2.0 • Extended Desktop Only • No Flash Player, No mobile. • Applications must be compiled to EXE, DMG, DEB, or RPM • Will NOT work on Mobile (Use Native Extensions for that)
Setting up a Project • New Flex App • Select "Desktop" • Use Flex 4 SDK or higher, we'll use 4.5.* • Edit your-app.xml • <supportedProfiles> extendedDesktop</supportedProfiles>
The Basics • You only need to worry about TWO objects! • NativeProcess • The actual running process • Add listeners to this (i.e. input/output) • NativeProcessStartupInfo • Instructions to get the process started: • Path to command • Arguments
Basics, Part Duex (Info) varinfo= newNativeProcessStartupInfo(); info.executable = "some/fun/program.exe"; info.arguments = ["-do","stuff"];
Basic, Part 3 (Process) varprocess = newNativeProcess(); process.start(info);
Basics, Part 4 (Events) • ProgressEvent.STANDARD_OUTPUT_DATA • The text comes out • ProgressEvent.STANDARD_ERROR_DATA • The error comes out • NativeProcessExitEvent.EXIT • The process is done… hopefully not on error
Compiling • Export release build as you normally would • Run ADT at command line Example: -package -target native myApp.exe myApp.air relevant document: http://goo.gl/ppmVS