Let me guess, your horoscope for today says that you’ll have a productive day if you focus on the important things. Let’s get on with it.
Here is a bit of prerequisite information, in case you need it:
Next, the ingredients for an ANE for Mac OS fall into two categories: libraries you have to make and a framework that’s already there for you to use.
Libraries you have to make:
- an AIR library, compiled as a .swf file;
- a native C, C++ or Objective-C library, compiled as an .a file.
The communication by these two libraries is handled by the third component, which Adobe has provided for you:
- the AIR C API.
The AIR library
The AIR library component of an ANE is like any other AIR library (Flex library project) with one exception: it has to contain an instance of flash.external.ExtensionContext. It’s through this class that the ActionScript side of your ANE will communicate with the AIR C API.
The AIR C API
Think of the AIR C API as the layer that sits between your ActionScript code and your native code. It is compiled into your native library and is responsible for ‘translating’ ActionScript calls into C and vice-versa.
For Mac OS the AIR C API is implemented as a framework: Adobe AIR.framework, which you include in your native library, together with the header file FlashRuntimeExtensions.h. You can see both of these in red in the diagram below.
The native library
You will typically have to write your native library in C, C++ or Objective-C and compile it into an .a file. Xcode is the tool normally used for that.
The ANE package
In order to be used as a native extension, your AIR and your native libraries need to be packed in an .ANE file. Adobe’s ADT command line tool does that for you. We will see how in Recipe for packaging an ANE.
- What goes into an ANE for iOS?
- What goes into an ANE for Android?
- What goes into an ANE for Windows?
- Prepare your ANE to be used in an app
Over to you
Do you know how to debug the native part of your extension on Mac OS? We would love to meet you if you do. Give us a shout in the comments below.