Compiling Actionscript 3 classes into a SWF with Flex Builder for use in JavaScript AIR applications

If you're a JavaScript developer building apps against the AIR platform then you're a rare breed. Those of us who want to leverage our existing skillsets are definitely in the minority, and in some cases so is our code. While the AIR runtime includes lots of handy classes for building robust rich internet applications, it's also missing quite a few. The thing is that while the AIR runtime might not include those classes by default, we can still use them if they exist in our project. This quick tutorial is going to show you just how you'd go about compiling class files down into a SWF that can then be referenced in your project. I'll be using Flex Builder to do the compiling, but you can also do it via command line using the Flex SDK.

A common request for an application might be to capture some portion of the application interface and save it to the file system as a JPG. The class package used in that action is com.adobe.images. You'll need to download the three AS files found in that package and store them on your machine somewhere. If you'd rather download the entire AS3 Core library, that's fine as well. Let's get started.