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:

  1. Download a native extension of your choice from http://www.adobe.com/devnet/air/native-extensions-for-air.edu.html
  2. Add the ane file (com.adobe.extensions.Vibration.ane in this example) from the Advanced Actionscript 3.0 Settings Library Path Panel
  3. 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:
    <uses-permission android:name=”android.permission.VIBRATE”/>
    Once the code was added, the VIBRATION check box would appear in the Flash CS6 panel.
  4. 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:
    import com.adobe.nativeExtensions.Vibration;
    var _vibrate:Vibration = new Vibration();
    _vibrate.vibrate(500);

So that’s all. Quite simple, isn’t it?

Advertisements

~ by brianchau on August 28, 2012.

3 Responses to “Using Native Extension with Flash CS6”

  1. Brian from one Flasher to another – Well done. This is the easiest definition on the interwebs today. Finally an easy concept explained in simple terms for Flash. All the other explanations are full of unnecessary jargon. Thanks for this example.

    If you get stumped on a Flash error check out http://www.curtismorley.com. The list is nearing 100% complete for all Flash and Flex errors.

    Thanks again for the great explanation.

  2. Hi,

    Is there any way to stop the vibration. For example in my app I am showing a popup with “ok” button. When popup displayed I am calling vibrate method for 3 seconds. In case user clicked on “ok” before that 3 seconds completed I want to stop the vibration. Is there any way to do it.

    Thanks in advance,
    Ranadheer

  3. This garbage adobe, all need this freshness only to the phone vibrate, just disistindo as not an idiot of a well-done tutorial, and the dung of files that come and format that does not support Flash, Flash Trash

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: