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.
Requirements:
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:
- Replace FREPenTablet/FREPenTablet/FlashRuntimeExtensions.h with AIR_SDK/include/FlashRuntimeExtensions.h
- Replace FREPenTablet/FREPenTablet/FlashRuntimeExtensions.lib with AIR_SDK/lib/win/FlashRuntimeExtensions.lib
Now that everything is setup, you can try compiling everything yourself.
- Open FREPenTablet/FREPenTablet.sln in Visual C++ 2010
- Build the .dll (F7)
- Import PenTabletLib into Flash Builder
- Build the .swc (Ctrl + B)
- Open the .swc with a .zip editor, and extract library.swf to the same folder as the .swc
- Build the .ane (run PenTabletLib/bin/package.bat)
- Import PenTabletDemo into Flash Builder
- Build the .swf (Ctrl + B)
- Build the .exe (run PenTabletLib/bin-debug/package.bat)
If everything was successful, you can draw on the stage with pressure sensitivity!

#1 by Brad on October 2, 2011 - 4:58 am
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 by Sean Fujiwara on October 6, 2011 - 2:18 am
I have not done any native extensions for Android. But, the high-level API should be exactly the same as the Windows version. So, you should be able to use my image processor extension as a starting point.
#3 by Brad on October 6, 2011 - 2:29 am
Thanks for getting back to me.
If you, or anyone else is interested, there is some info on using FreBitmapData objects for Android at
http://recycledinformation.blogspot.com/2011/10/air-extensions-in-java-frebitmapdata.html
#4 by Ky Lân on January 6, 2012 - 3:30 am
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 !
#5 by Sean Fujiwara on January 6, 2012 - 3:35 pm
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.
#6 by parizer on March 11, 2012 - 5:22 am
Is it possible to track mouse and mouse clicks on Windows with AIR app in system tray (+native extension)?
#7 by parizer on March 11, 2012 - 5:44 am
PS. something like this http://flowingdata.com/2010/02/09/track-mouse-activity-on-your-computer/
#8 by Sean Fujiwara on March 11, 2012 - 11:26 am
Yes, it should be, it’s just a matter of getting those events in your DLL. I’m not sure exactly how, but here’s the MSDN page on mouse input: http://msdn.microsoft.com/en-us/library/windows/desktop/ms645533(v=vs.85).aspx
#9 by Aviv Heilweil on July 17, 2012 - 2:37 am
Does it support Galaxy S Pen? Is there a native extension that connects to the S Pen SDK?
#10 by Sean Fujiwara on July 17, 2012 - 4:30 pm
You’re asking about a phone, right? No, I don’t know of any extensions for that. You can always create your own, but it would be much different than this example.
#11 by Park Cheol Wan on July 19, 2012 - 11:10 am
how to know max tablet’s Pressure?(512,1024,2048)
..
i dont find it.. help
#12 by Sean Fujiwara on July 19, 2012 - 11:26 am
I’m not sure if it’s possible, but you would be able to find out on this page:
http://www.wacomeng.com/windows/index.html
#13 by Juho on October 23, 2012 - 6:53 am
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?
#14 by Juho on October 23, 2012 - 11:53 pm
Problem solved by using Flex SDK 4.6.
#15 by Bruce Lane on November 5, 2012 - 2:24 pm
Yes! It works fine for me launching the .exe file. I guess it can’t run from Flash Builder, you have to use package.bat to generate the .exe to debug?
#16 by Bruce Lane on November 7, 2012 - 12:20 pm
I am on win8, and my FB 4.6 is ‘waiting for backgroung task’ forever… weird… I’ll let you know when I find out why
#17 by Bruce Lane on November 8, 2012 - 3:00 am
it’s ok now, I had to create a new workspace.
But now I need to create a “release” version otherwise the PenTabletDemo.exe needs a debug DLL called MSVCP100D.dll
#18 by Bruce Lane on November 8, 2012 - 12:03 pm
now I cry: https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-frc1/665539_4780177106614_59782793_o.jpg
#19 by Bruce Lane on November 8, 2012 - 7:29 pm
has anyone tryed to recompile successfully this projects?
thanks for letting me know
#20 by nthere9 on December 28, 2012 - 12:21 am
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 ?