AIR 3 Native Extension Example – PenTablet

This native extension allows you to read pressure sensitivity data from a pen tablet. It’s only been tested on Windows 7 with a Wacom Intuos 4. I’ll go through the build steps in the same format as last time.


Checkout the project on GitHub for all the code.

  • Source files
  • Project files for Visual C++ and Flash Builder
  • Batch files so you don’t have to use the command line
  • All intermediate files

The project contains some placeholder files that I cannot include in the repository because they are copyrighted by Adobe. After checking out the project, you need to:

  1. Replace FREPenTablet/FREPenTablet/FlashRuntimeExtensions.h with AIR_SDK/include/FlashRuntimeExtensions.h
  2. Replace FREPenTablet/FREPenTablet/FlashRuntimeExtensions.lib with AIR_SDK/lib/win/FlashRuntimeExtensions.lib

Now that everything is setup, you can try compiling everything yourself.

  1. Open FREPenTablet/FREPenTablet.sln in Visual C++ 2010
  2. Build the .dll (F7)
  3. Import PenTabletLib into Flash Builder
  4. Build the .swc (Ctrl + B)
  5. Open the .swc with a .zip editor, and extract library.swf to the same folder as the .swc
  6. Build the .ane (run PenTabletLib/bin/package.bat)
  7. Import PenTabletDemo into Flash Builder
  8. Build the .swf (Ctrl + B)
  9. Build the .exe (run PenTabletLib/bin-debug/package.bat)

If everything was successful, you can draw on the stage with pressure sensitivity!


22 thoughts on “AIR 3 Native Extension Example – PenTablet

  1. Really awesome work! Thanks for sharing.

    side note:
    Not sure if you have done any native extensions for Android, but I have been struggling to pass BitmapData from actionScript to Java, do you have any idea how to do it?

    There is a FREBitmapData class included in the FlashRuntimeExtension jar, but I havent been able to use it successfully.

  2. Hi ! And thanks a lot for sharing your code !

    I’m an AS3 dev, not a C dev. Do you think there is a chance to port your code for MacOS ? Or it’s totally different ?

    Thanks again !

    • Wacom has an SDK for Mac OS X, so it should be very similar. But, I’ve never done any Mac development, so I’m not sure what’s involved. It would be much better if somebody who uses a Mac did it, because it’s hard for me to test. I won’t say “no chance”, but not soon.

  3. I’m interested in this. I managed to compile in the Visual Express (F7), but I’m stuck in Flash Builder. There’s an error on line “import flash.external.ExtensionContext;”

    1046: Type was not found or was not a compile-time constant: ExtensionContext.

    It cannot find the Class ExtensionContext. I tried to import flash classes to the project but no luck. I cannot compile.

    Any ideas?

  4. Thanks for share, I have problem with importing .ane files into flash builder.
    1- Add .ane file from Properties/Flex Build Path/Native Extensions
    2- Checked in Build packaging/Native Extensions my .ane file
    3- I saw ExtensionID in application descriptor file
    4- also added .swc file as external
    When I try to use my app in another platform(Premiere Pro editor software) couldn’t found class that I created in lib project.
    Do you suggest me anything ?

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s