views:

189

answers:

2

Hi, I'm Fran.

I have built a application that use a nativeProcess to open exe.

The application into Flex Builder 3 run whitout errors.

Then the problem come when I export the aplicaction AIR in .air and install the applicaction in the developer pc or other pc.

When I push the button to open the .exe, appear the message "Native Process is not supported".

The code in the main.mxml that I use:

if (NativeProcess.isSupported)
            {
                var file:File = new File("app:/config/AbrirAplicacion.exe");
                var nativeProcessStartupInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
                nativeProcessStartupInfo.executable = file;

                process = new NativeProcess();
                process.start(nativeProcessStartupInfo);
                process.standardInput.writeUTFBytes(textReceived.text+"\n");
                process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
                process.addEventListener(ProgressEvent.STANDARD_INPUT_PROGRESS, inputProgressListener);
            }
            else
            {
                textReceived.text = "NativeProcess not supported.";
            }

Any ideas of what I'm doing wrong?

+1  A: 

NativeProcess is only available when applications are compiled to native binaries, not .air installers.

HTH

J

Zárate
A: 

NativeProcess can be compiled with Air2 it's just very tricky. The problem is that you have to COMPLETLEY overlay your Flex SDK and the new Air2. Surprisingly, according to this link, you cannot do it through the finder and should do it through the terminal. In Mac:

  1. Download the SDK from Air SDK and put it in folder 1.
  2. Make a copy of your flex SDK and put it on folder 2 (in the flex Builder sdks folder)
  3. Write ditto -V folder1 folder2 in the terminal to overlay them.

Now go to your project's preferences and select the folder2 as sdk (now it's overlay with folder1).

Also, you will probably need to change the description to:

http://ns.adobe.com/air/application/2.0

There is very good description on Installing the Adobe AIR 2 SDK in Eclipse (check part 3).

Hope that helps.

Skuge