Before we define what Adobe AIR Native Extensions (ANEs) are, let us first marvel at Adobe AIR for a bit, starting with what it can do for you. Then we will move on to what it can’t do for you. That’s where it gets interesting and where ANEs come in.
What is Adobe AIR?
- AIR is a runtime, developed by Adobe.
- AIR comes with an ActionScript 3 Application Programming Interface (API).
- AIR lets you do cross-platform programming. It compiles your ActionScript 3 code into a native app for a number of platforms: iOS, Android, Mac OS, Windows, Blackberry.
What AIR can’t do for you…
The diagram above shows you what Adobe AIR does for you: it allows you to program on several different platforms using single code base. In order to understand why you might need an extension for AIR and what that is, we’ll look at what AIR can’t do for you:
- AIR can’t give you access to some platform-specific functionality, like working with the gyroscope on your phone, reading battery data, reading pen tablet pressure, using speech recognition, controlling the camera exposure and focus, sending e-mails with attachments, etc.
- AIR also won’t give you low-level access to the device your app is meant to run on. Low-level access to the native API or even hardware is useful for parts of your app where high speed or efficient memory usage are critical.
- AIR won’t talk to native libraries out of the box. A native library in this context is one that was written in one of the platform’s native languages, like Java for Android or C, C++ or Objective-C for iOS. You might want to use one you’ve downloaded or inherited from your old code base that deals with platform-specific problems, instead of writing your own from zero.
What are AIR Native Extensions (ANEs)?
You can think of a native extension (ANE) as an ActionScript 3 wrapper around a native library.
The native library helps you solve one or more of the issues listed above:
- find a platform-specific solution;
- use the native API for speed or memory optimization;
- use other, already existing, native libraries.
An ActionScript 3 wrapper around this native library provides an interface for AIR to talk to. It effectively makes the native library look like an ActionScript library to AIR.
Over to you
What are you struggling with right now that’s AIR-related?
Let us know in the comments below.