This post will show you how to create an AIR Native Extension for Windows. Specifically, we will create an extension which uses .NET to transcode BitmapData objects into .bmp, .jpg, and .png formats much faster than existing ActionScript or Alchemy methods.
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:
Now that everything is setup, you can try compiling everything yourself.
- Open FREImageProcessor/FREImageProcessor.sln in Visual C++ 2010
- Build the .dll (F7)
- Import ImageProcessor 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 ImageProcessor/bin/package.bat)
- Import ImageProcessorTest into Flash Builder
- Build the .swf (Ctrl + B)
- Build the .exe (run ImageProcessorTest/bin-debug/package.bat)
If everything was successful, you can run the .exe and click the stage to encode a JPEG. It will be saved to “C:\temp.jpg”.