Demonstrates how to create a .swc library for ActionScript 3.0 using OpenFL and Haxe. This allows AS3 developers using Adobe AIR to access Haxe libraries too.
To build the .swc library, use the following command:
openfl build flash -debug
The file will be created at bin/flash/bin/mylibrary.swc.
To use the .swc library in an ActionScript project, add it with the --library-path
compiler option.
mxmlc --library-path+=mylibrary.swc
During startup, such as in the constructor of the main AS3 class, you should add the following AS3 code because it initializes a few things that are expected by Haxe-compiled .swc libraries:
haxe.initSwc(null);
Sample created by Josh Tynjala, the author of Feathers UI and core contributor to OpenFL.