This tutorial will guide you the process of adding an ANE to your AIR application project in FlashDevelop.
An AIR Native Extension (ANE) is a single file with the extension
ane. This file contains all of the native and actionscript libraries that are implemented by this extension. You don’t need access to a separate SWC file or to the source code to be able to use the ANE.
Adding the Extension
For the purposes of this example we are going to create directories named
extensions-extracted. You can name the directories as you require, and they can be the same directory if you wish, however we will keep them separated here to demonstrate the usage of each.
- Copy the ANE to the
- In FlashDevelop, right click on the ANE file and select Add To Library
- Unzip the ANE to a folder named
extension_id.ane, in the
- the extension id is not neccessarily the same as the name of the ANE file however with nearly all distriqt's ANEs it will be, see below to determine howto get the extension id from an ANE;
An ANE is simply a zip container so you can directly unzip it, or if you need to, rename it to have the
.zipextension and open it in your zip software.
For example with the Battery ANE, you should have the following:
Unzipping the extension to the extracted directory is used by Flash Develop for debug launches. You should ensure every time you update an ANE that you update the extracted folder as well.
Adding the Extension ID
FlashDevelop requires that you manually add the extension id to your application descriptor.
The extension id is a string that is used to identify the ANE and correctly package and create the extension. The extension id should be provided by the developer of the ANE.
To add the extension id, open up your application descriptor and add the extension id to the
extensions node as below:
Determining the Extension ID
The native extension ID is not necessarily the name of the ANE file. If you are unsure of the extension id it can be determined from the extracted contents of the ANE.
- Unzip the ANE;
- Find the
<id>tag, this will contain the extension id;
For example for the Battery ANE:
With the distriqt extensions the extension id is the name of the ANE file, eg for the Battery ANE the file is
com.distriqt.Battery.aneand the extension id is
Extensions that have multiple versions, eg PushNotifications, where there are multiple files:
the extension id is the first part of the filename without the variant: i.e.
If you have any concerns drop a question in github and we will clear up any confusion.
Modify Build Scripts
FlashDevelop uses a series of scripts to package and run your application. We have to modify these scripts to be able to correctly specify the location of the extensions.
The packager script is used to package your application. You will need to find the
adt line and add the
-extdir option specifying the directory containing the extensions as follows:
The run script is used for debugging your content. We need to find the
adl line which is the debug launcher and add the
-extdir option as follows:
You will now be able to package and use the extension in your application.