Show progress bar and percents when packaging a native installer with adt packager
Hello,
Below is a simple example using the AIR's NativeProcess for compiling an air application into a native installer... Everything works fine, so at the end of the NativeProcess, the native installer (*.exe) is created... In this case, the application which I'm trying to compile is small (approx. 600KB)... However, if I have to package into native installer a bigger file (several MBs), I would like also to monitor the progress by using a progress bar and percents... How?
private var file:File
private var nativeProcessStartupInfo:NativeProcessStartupInfo;
private var nativeProcess:NativeProcess;
private function compile():void{
file = new File("C:\\Program Files\\Java\\jre7\\bin\\java.exe");
nativeProcessStartupInfo = new NativeProcessStartupInfo();
var args:Vector.<String> = new Vector.<String>();
args.push("-jar");
args.push(adtPath);
args.push("-package");
args.push("-storetype");
args.push("pkcs12");
args.push("-keystore");
args.push(certPath);
args.push("-storepass");
args.push("mypass");
args.push("-target");
args.push("native");
args.push(exePath);
args.push(xmlPath);
args.push("-C");
args.push(swfPath);
args.push("testApp.swf");
args.push("icons");
nativeProcessStartupInfo.arguments = args;
nativeProcessStartupInfo.executable = file;
nativeProcess = new NativeProcess();
nativeProcess.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
nativeProcess.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
nativeProcess.start(nativeProcessStartupInfo);
}
private function onOutputData(event:ProgressEvent):void{
var op:String = nativeProcess.standardOutput.readUTFBytes(nativeProcess.standardOutput.bytesAvailable);
trace("output = " + op);
}
private function onErrorData(event:ProgressEvent):void{
var er:String = nativeProcess.standardError.readUTFBytes(nativeProcess.standardError.bytesAvailable);
trace("error = " + er);
}
Thanks in advance,
Nikola
