1. Create a new folder called "swc", and place it somewhere easy to access, such as "d:\flex\swc"
2. Create a simple actionscript class, such as the following "Hello.as" file, and place it in the "swc" folder.
package swc
{
public class Hello
{
public function Hello()
{
trace("hello");
}
}
}
2. Locate your compc.exe file in the Flex SDK. If you are using Flexbuilder 3, it should be located in the "C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0\bin" directory.
3. Run the compc.exe file by navigating to the same directory via the command prompt, then type the following in RED on the same line (separated here only for readability) :
compc.exe
-source-path=D:\flex [path to your package]
-include-classes swc.Hello [this dot notation must match exactly the same as designated by the package in the class]
-output=D:\flex\swc\bin\myHello.swc [where you want the swc generated and it's name]
4. When you hit return, a folder called "bin" will be created with the swc file inside it. Create a new Flexbuilder 3 project, and simply place this swc into the libs directory. That's it! It is now ready to be accessed via AS3 or through the mxml, such as in the following example:
import swc.Hello;
public var myHello:Hello = new Hello;
//instantiated through mxml
xmlns:swc="swc.*"