Windows ANE tutorial: Testing the ANE

By this part you have already packaged a Native Extension for Windows or have one at hand from elsewhere. In this article we will see how to include it in an app and use it.

At the end of this part you will have:

An Adobe AIR Native Extension (ANE) ready to be used on Windows.

Time

12-15 minutes

Wait, have you done this first?

Alternatively, if you don’t need to learn how to make an ANE yourself, but want to know how to use one on Windows, skip the prerequisite parts and read on.

Step 1: Create a Windows Desktop project

In Flash Builder slect File > New > Flex Project:

Create a Flash Builder app for Windows

 

Give the project a name and make it a Desktop project:

Create a Flash Builder app for Windows Desktop

Click Finish to create your project.

Step 2: Add the ANE

Two of Adobe’s tools will need to be able to see your ANE: the compiler and the packager.

First, let the compiler know where the ANE is by opening your project’s Properties > Flex Build Path > Native Extensions. Click Add ANE… and navigate to your ANE. I tend to copy if in the app’s libs/ane folder, or rather, my build scripts do that for me.

Include the ANE in the build pathNext, make sure the packaging tool knows to link the ANE in the app. Still in the Properties dialog, open Flex Build Packaging > Native Extensions. You should see the ANE listed there. Make sure you tick the box under Package, so that the ANE gets included in the app.

Include the ANE in the app package

Step 3: Add testing code

Here we will do the minimum we can get away with: add a text box and a button to your app’s main file (.mxml). When the button is pressed, it will call the method you defined in the native extension.

Step 4: Run the app

Run the app in the Flash Builder debugger. When you click the Test ANE button, you should see the ANE in action: passing a string to the native DLL and receiving it back:
Run the app

 

What’s next?

Opt In Image
Early bird offer on the ANE eBooks

 

Buy any Easy Native Extensions 2nd Edition package and get our $99 iOS + Android ANE Template completely free before the end of June 2015.

 

 

  • step-by-step guide to making your iOS extension in under an hour
  • library for data conversion between ActionScript and native code
  • tutorials
  • infographics
  • code included

 


Warning: count(): Parameter must be an array or an object that implements Countable in /home/easyna6/public_html/easynativeextensions_wp/wp-includes/class-wp-comment-query.php on line 399

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">