Jump to content
Larry Ullman's Book Forums
Necuima

How To Test If Nativeprocess Is Supported

Recommended Posts

Hi,

 

I'm trying to test if NativeProcess is supported in my installation.

 

My  environment is:
. Windows 7 Home Premium 64 bit
. Internet Explorer 10
. Firefox 22.0
. Dreamweaver CS5 as the text editor

. Flex 4 via FlashBuilder 4

. XAMPP for Windows 1.8.3 which comprises:

.. Apache 2.4.4

.. PHP 5.5.3

.. MySQL 5.6.11

.. phpMyAdmin 4.0.4

 

FlashBuilder gives me the following error:

'Access of undefined property NativeProcess'

 

<?xml version="1.0" encoding="utf-8"?>

<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"

xmlns:s=""

xmlns:mx=""

width="850" height="500"

creationComplete = "onCreationComplete()">

 

<fx:Script>

<![CDATA[

import flash.events.Event;

import flash.desktop.NativeProcess;

import flash.desktop.NativeProcessStartupInfo;

import flash.events.NativeProcessExitEvent;

import mx.controls.Alert;

import mx.rpc.events.FaultEvent;

import mx.rpc.events.ResultEvent;

 

private function onCreationComplete():void {

processingStatus.text = 'Awaiting start of the test';

}

 

private function doTest(): void

{

if (NativeProcess.isSupported)

{

processingStatus.text = 'Native Process Is Supported';

}

else

{

processingStatus.text = 'Native Process Is Not Supported';

}

 

} // end doTest function

 

]]>

</fx:Script>

 

<mx:Form x="42" y="48">

<s:Label color="blue" fontSize="20" fontWeight="bold" text=" NATIVE PROCESS TEST"/>

<s:Label width="5" height="5" text=""/> <!-- just to put a space between the two displays -->

<s:Button id="resizerButton" label="Click to Start The Test" click="doTest()"/>

<s:Label width="5" height="5" text=""/> <!-- just to put a space between the two displays -->

<mx:FormItem label="Processing status is:" fontWeight="bold">

<s:Label id="processingStatus" fontSize="12" fontWeight="bold" color="red"/>

</mx:FormItem>

 

</mx:Form>

</s:WindowedApplication>

 

If anyone can give me some insights as to why this error is occurring and, if possible, how to overcome it, this will be most appreciated.

 

And many thanks in anticipation,

 

Cheers from Oz.

Share this post


Link to post
Share on other sites

Hi Larry,

 

Firstly thanks for getting back to me - we hope and trust that you and your family had a 'Merry Christmas' and we extend our best wishes to you all for 2014.

 

Re the NativeProcess test - after following up your lead, Googling a lot, and quite a bit of trial and error, I found that the following does not give errors and does indeed enable the test to be run. 

 

The test needs the Flex 4.6 (or presumably greater) SDK.

 

Then, I downloaded the AIR 2.x SDK.  In that I found the file Adobe AIR.dll (size 20504Kb).

 

I replaced the dll in the 4.6 SDK with the dll from the AIR SDK above.

 

Then I added the following to the xx-app.xml file: 

 

<supportedProfiles>extendedDesktop</supportedProfiles>

<versionNumber>1</versionNumber>

 

And then the test ran!!

 

The version number requirement taught me to read error messages very carefully!!  As at first I thought there was something wrong with the application version designator but after reading the complier error message a few more times I added the versionNumber code and voila that was the last missing piece in the jigsaw. 

 

Posted here in case someone else is mad enough to want to try this!

 

Now I will try and get a NativeProcess to actually run!!  I'll let you know in due course.

 

Cheers from Oz.

Share this post


Link to post
Share on other sites

But there's often a BUT!!

 

It runs happily within FlashBuilder using CTRL+F11 BUT it won't let you create an air file!!  The creation process starts normally but then seems to go into a loop! 

 

I also got an Image Magick native process to work but only within FlashBuilder using CTRL+F11.

 

I have spent a lot of time on this and have pretty much achieved my objective which was to see if I could get a NativeProcess to work within Flex/ActionScript3, which it sort of does:-)

 

Comments will be appreciated and thanks in anticipation,

 

Cheers from Oz.

Share this post


Link to post
Share on other sites

Thanks for the nice words. Hope you're doing well as well, and a happy holidays down your way! 

 

I'd love to be able to help you here, but I'm no Windows expert and I haven't kept up my AIR or FlashBuilder skills. In short, you're well past my level already. Sorry!

Share this post


Link to post
Share on other sites

Hi Larry,

 

Have made a little progress but still not there yet!

 

Our daughter has FlashBuilder 4.6 so I tried that.  In 4.6 I don't need to 'meddle' with the 4.6 SDK and I can now both run a native process with FB's CTRL+F11 and also build it OK for regular execution.

 

But (there's still those buts!!) even though the app runs perfectly within FB using the CTRL+F11 approach, the app just 'hangs' when I try to execute it from its AIR-installed exe.

 

The execution starts just fine but once the Image Magick native process is started the app just hangs.  It does not appear to be in a loop as the process is not using any CPU so it looks like some other factor is making it 'hang'.

 

I have event listeners for all the events that appear to be supported by the native process functionality.

 

Do you have any advice on how to debug this?  Any thoughts will be most appreciated.

 

Cheers from Oz.

Share this post


Link to post
Share on other sites

You know me - I keep trying to unravel this mystery!!  I am beginning to think that this is nothing to do with event listeners but with configuration.  The Adobe website which discusses native process says that, inter alia, you need to have the 'supported profiles' value in the -app.xml file set as 'extendedDesktop' - see an earlier post above.  If you do this, the program runs perfectly within FlashBuilder using the CTRL+F11 'run' facility.  Now here's the BUT: if you try and export build with that supported profile, you get an error message listing the profiles it supports but 'extendedDesktop' is not one of them - 'desktop' is.  I had the supported profile set as both 'extendDedsktop' and 'desktop' and this export-builds OK and will convert to an executable OK with AIR 3.1 and 3.9. (FlashBuilder 4.6 says that it needs 3.1 so I downloaded that but that gave the same 'hanging' run condition).  A check of the Windows event logs does not reveal anything to do with the execution of the .exe file, and as mentioned before, it is not using any CPU so does not appear to be in a loop.

 

I have scoured the web and came across what appeared to be a similar issue and the author used the native adt packaging from the AIR sdk.  I tried this too but still get the support profiles error.  (I just packaged up the mxml, -app.xml and the swf files from FlashBuilder - maybe that's not the way to do it). I tried both the current 3.9 and the 3.1 AIR sdks but get the same error with both sdks.

 

Again, if anyone has any suggestions, I will welcome them, and thanks in anticipation.

 

Cheers from Oz.

Share this post


Link to post
Share on other sites

I am about to give up on this one! It's a bit like bashing your head against a brick wall - it's nice when you stop!!

 

Bottom line: the SDK, either within FlashBuilder or in stand-alone mode (per Larry's FLEX book page 31)just won't let you package the application into an air file with an 'extendedDesktop' (only) supported profile, though this profile works perfectly within FlashBuilder's 'run' facility.

 

And if you use the 'desktop' supported profile it packages OK but then the application just hangs upon execution! (And it does not run within the FlashBuilder 'run' facility). It's a bit like being between a rock and a hard place!

 

But for anyone who looked at this and thought about it - Thanks!

 

Cheers from Oz.

Share this post


Link to post
Share on other sites

Eureka!!! Got it. Found the answer on another forum. You have to export-build the app as a 'signed native installer', not a 'signed AIR package'. Halleluiah!!

Share this post


Link to post
Share on other sites

So cool. BIG KUDOS for figuring this out, Eric, and thanks for sharing what you've learned. Hopefully the process of figuring this out was more rewarding than it was frustrating!

Share this post


Link to post
Share on other sites

Hi Larry,  Thanks for the feedback.  I must admit that being able to eventually find out what the issue was is most gratifying - one can still learn stuff as a septuagenarian:-)

 

It seemed that I was close as the application ran perfectly within the FlashBuilder 'run' framework so it had to be something to do with the export build process (and it was).  I was considering giving up as my head was getting sore from those brick walls but I thought that I'd give it one more try and that try led to the solution.

 

FYI your 2nd edition E-Commerce book arrived in the mail yesterday and I'm keen to read about Stripe payments!  I trust that things are going well for you with them.

 

Best wishes from Oz.

Share this post


Link to post
Share on other sites

Thanks! Stripe is going well. I enjoy working with them and am honored to be a part of the organization. I'm still trying to figure out a schedule and approach that's sustainable, though. I accepted the job on a part time basis, in part so that I can maintain my other obligations. Right now I'm working 5 six-hour days a week for them and the other 2 days a week for my other stuff, which means i'm working 7 days a week and still not keeping up. So I've got to figure that out.

 

But we're in beta in Oz!

Share this post


Link to post
Share on other sites

Thanks for the update - much appreciated.  You make interesting comments to which I can relate.  All my career I struggled with the work-life balance and also the tension within me between my managerial role and my technical passion.  Luckily I worked for an American multi-national corporation and a couple of times they made career adjustments for me and they were very supportive when I became seriously ill at one stage.  So good luck with getting the balance right!

 

Great to hear that Stripe is coming to Oz!

 

Best wishes, Eric.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...