Using Native Extension with Flash CS6
Most of the tutorials on using Native Extension have been about using it with Flash Builder 4.6. The fact is Flash CS6 has also added the capability of using Native Extension and it is just as easy. Here are a few simple steps for building an Android AIR app:
- Download a native extension of your choice from http://www.adobe.com/devnet/air/native-extensions-for-air.edu.html
- Add the ane file (com.adobe.extensions.Vibration.ane in this example) from the Advanced Actionscript 3.0 Settings Library Path Panel
- Select any necessary permission from the AIR for Android Settings. In this example Vibration was not available at Flash CS6 panel. So I added in the following code in the app descriptor xml file:
Once the code was added, the VIBRATION check box would appear in the Flash CS6 panel.
- Now to access the feature in the native extension, simply import the class file and write your AS code. Flash code editor would add in code hinting and code completion of the class file to help you write your code. In this example which is about accessing the vibration feature of the Android device, code may be like the following:
var _vibrate:Vibration = new Vibration();
So that’s all. Quite simple, isn’t it?