Creating SWCs using Flex 2 Builder
With the recent release of Cairngorm 2 Alpha 2 from the guys over at Adobe Consulting i decided to compile Cairngorm 2 into a SWC file using Flex 2 Builder. This is similiar to .NET in that you can create class libraries and compile them into .NET assemblies (dll files).
The steps i took to accomplish this task were as follows…

Select File –> New –> Flex Library Project which should look like the above.

Next step is to enter your project name and path to the location of the AS3 files. Once you have done that press next.

The next screen should be the build paths with tabs four tabs called Classes, Resources, Class path and libraries. The on we are interested in is the Classes tab. As you can see above i have selected all the files which i want to be compiled into a SWC file. You do the same and then when you are done press finish.
If all goes well you should see a [project_name].swc in the bin directory of your Flex Library Project. The last step is to add it as a library to your project.

To do this you need to have one of your project files open in Flex 2 Builder. Select Project –> Properties and then Flex Build Path on the left. You should then see something resembling the above image. Select the Libraries tab and then press on Add SWC…, locate the SWC file that you have just compiled. It will be added to the bottom of the list. Press OK and Flex 2 Builder will now include this library in your project.
To test if the library is working properly type import [package] (e.g. import org.nevis.cairngorm.model.ModelLocator;) and save your project, if there are no errors then perfecto everything works.
This feature rocks!!!!



Glad you like this feature! This is a great explanation of how to create a SWC. One minor correction though- resource bundle SWCs refers to SWCs used for localization. These are SWCs used with the new resource bundle feature in the beta. Other SWCs, like the one you created, are just referred to as SWCs.