This is a quick walk trough on how to use ANE (AIR Native Extension) in Flash Professional CS5.5. I assume you know what ANE is, but if you want, you can read Abode’s overview here ANE it basically a method to call native code from within Adobe AIR applications.

To use Native Extension, you need to have AIR 3.0, which you can install to Flash Professional CS5.5 by following Adobe’s guide here:


For this article, I’m going to use one of Adobe’s example, the Vibrator extension.

1. Create a blank Flash movie. Add a button on the stage, name the instance button. Save the FLA as TestANE.fla.

2. Download the Vibrator files from Adobe: Article:

3. Extract the Vibrator files. Then copy the files from VibrationNEDeliverables\ReadyToUseExtension folder (You’ll see .swc, .ane, .txt files). Copy those files to the a lib subfolder where you have the FLA created in Step 1. You can open the extensionID.txt to see the package name of the ANE.

4. Add the swc file from the ANE into the Flash project.

5. Add a document class to your FLA

In this example, I’m calling the document class TestANE.

6. Edit For this simple example, our app will do nothing but call the extension when the button is tapped.

Import the ANE package using this line:

	import com.adobe.nativeExtensions.Vibration;

Then, add the code to handle tap (mouse click).

button.addEventListener(MouseEvent.CLICK, onClicked);

private function onClicked(event:Event):void
  // we will fill this later

7. Now, there’s a slight issue. We don’t know what methods and classes are available in the ANE. There are several options here: 1) read documentation that comes with the ANE to see what methods are available in the ANE, at
b) expand the ANE in FlashDevelop by adding it to a project and bouble clicking on it.

There, you can see:

package com.adobe.nativeExtensions
	import flash.external.ExtensionContext;

	public class Vibration extends Object
		public static function get isSupported () : Boolean;

		public function vibrate (duration:Number) : void;

		public function Vibration ();

So let’s roll. Go back to our and edit the onClicked() method:

private function onClicked(event:Event):void
  var vibe:Vibration;
  if (Vibration.isSupported)
    vibe = new Vibration();

Always check whether the extension is available by calling isSupported. Most well built extension has this method.

So now the full content of is as follows:

package  {
	import flash.display.MovieClip;
	import com.adobe.nativeExtensions.Vibration;
	public class TestANE extends MovieClip {
		public function TestANE() 
			button.addEventListener(MouseEvent.CLICK, onClick);
		private function onClick(event:MouseEvent):void
			if (Vibration.isSupported)
				var vibration:Vibration=new Vibration();


8. Publish. Make sure to publish to a subfolder. Below I’m publishing to bin subfolder.

9. If you try running the resulting output, you’ll get an error. Modify the build settings to acommodate the ANE. Add the tag into to the build settings XML (in my case, it’s at bin\TestANE-app.xml:


If you read this particular extension documentation, there’s one permission that you need to add to allow Android devices to vibrate:

<uses-permission android:name="android.permission.VIBRATE"/>

So, edit applications.xml (this is the default xml used by Flash Develop when packaging your app) so that it looks something like this:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<application xmlns="">

<!-- To localize the description, use the following format for the description element.<description><text xml:lang="en">English App description goes here</text><text xml:lang="fr">French App description goes here</text><text xml:lang="ja">Japanese App description goes here</text></description>-->


<!-- To localize the name, use the following format for the name element.<name><text xml:lang="en">English App name goes here</text><text xml:lang="fr">French App name goes here</text><text xml:lang="ja">Japanese App name goes here</text></name>-->






<uses-permission android:name="android.permission.VIBRATE"/>



Make sure you can spot where I added the two entries.

10. Build using adt because unfortunately Flash CS5.5 IDE currently does not support doing this directly from the IDE. (More info on running adt can be read here:

In our example, this is the command:

PATH_TO_ADT\adt -package -target apk-captive-runtime -storetype pkcs12 -keystore "YOUR_CERTIFICATE_FILE" -storepass YOUR_CERTIFICATE_PASSWORD "TestANE.apk" "bin\TestANE-app.xml" -C bin . -extdir lib/

PS: You might encounter this message when publishing from Flash IDE after adding the above. This can be ignored because what this says is that the extension does not work on your Desktop machine, which is true (do you know of a desktop computer that support vibration, ha?):

  • Replace PATH_TO_ADT with the path to your adt. PS: When using command-line prompt, in Windows, you must use the DOS path-name, and C:\Progra~2\Adobe\Adobef~1.5\adobef~1.5\AIR2.6\bin\adt is equivalent to C:\Program Files (x86)\Adobe\Adobe Flash CS5.5\Adobe Flash CS5.5\AIR2.6\bin which where I have AIR SDK installed. This value depends on where you installed AIR ASK, so you can’t just copy that path. If you don’t know how to get the DOS name, this might help:
    PS: Reader Dave alerted me that you can use the long path name by putting it in quotes. Thanks.

  • Replace TestANE-app.apk with whet your APK filename should be named (avoid spaces and weird characters).
  • Replace TestANE-app.xml with your application XML (this file is created by Flash IDE when you set target to AIR for Android or AIR for iOS; this was also the file we edited in Step 8).
  • lib/ is the folder name where I copied the ANE files in step 3.

If there’s no error, the output APK can be run on a Device (the emulator won’t Vibrate and most ANE won’t run on the Emulator). For iOS, you can do the usual iTunes or TestFlight route. For Android, the command is something like this from the command line (this is adapted from a Flash Develop batch file):

adb devices
adb -d install -r TestANE.apk

if errorlevel 1 goto installfail

echo Starting application on the device for debugging...
adb shell am start -n air.TestANE/.AppEntry

echo Installing the app on the device failed


Remember to replace TestANE.apk with your APK filename and air.TestANE with air.YOUR_APP_ID.

If everything goes well, your phone should vibrate when tapped (note: iPad and iPod Touch does not support vibration as far as I know).

Download Example

Sample to download (contains portion from Adobe at Note: Edit build.bat to recompile.

3 Responses to “Using ANE (Air Native Extension) in Flash Professional IDE”

  1. Hi Guys,

    How are you?

    I am trying to develop an app that has the vibration functionality on the latest IPhone but everytime it reaches the vibration code on the ‘swf’, it freezes.

    1. I installed AIR 3.0 on Flash Professional.

    2. Got the ReadyToUseExtension.

    3. Added the com.adobe.extensions.Vibration.swc with external linkage selected on the AS3 publishing area.

    4. Added the VibrationActionScriptLibrary.swc on the AS3 publishing area.

    5. added the code below to the fla:

    import com.adobe.nativeExtensions.Vibration;
    if (Vibration.isSupported) {
    var vb:Vibration=new Vibration();

    6. Control test movie to make the swf and app.xml. I tried on both, Air for IOS and AIR 3.0. (since publishing gives me ane/vibration error)

    7. Edited the app.xml adding the extension code and the android permission as above.

    7. Combined everything with adt on the terminal, like this:
    AdobeAIRSDK/bin/adt -package -target ipa-ad-hoc -storetype pkcs12 -keystore Certificate.p12 -provisioning-profile Provision.mobileprovision MYAPP.ipa MYAPP-app.xml MYAPP.swf -extdir extensions AppIconsForPublish/72×72.png AppIconsForPublish/512×512.png AppIconsForPublish/114×114.png AppIconsForPublish/48×48.png AppIconsForPublish/57×57.png AppIconsForPublish/29×29.png

    8. The app is created as ipa.

    9. I send it to IPhone with ITunes.

    10. When I get to the vibration frame on the swf, the app freezes.

    Could you help me, please? Am I doing something wrong? It is my 4th day on it.

    Thank you very much for your help,


  2. Hi Francisco,
    I think the issue you’re having is due to not linking the ANE as an “External” library (this requirement appears to be specific to IPAs built as non-interpreter target).
    See, the answer by Saumitra (on the first post, marked as Correct Answer).

  3. Hi Lucia,
    I’m not sure. I’m fed up with Facebook changes these days. Does my example still work? I have not changed anything on the example, so if it no longer works, then it’s probably something on FB did indeed change.

Leave a Reply