Export as swc library file?

Hi, I was wondering if it is possible to use the Flash target to export a swc library file instead of the swf one.

I’m working on a bigger project that will have a web browser visualization and also an AIR application. For the browser, OpenFL is perfect and I hope to get results running on both Flash and HTML5 targets. The app version, however, uses many features currently not available from “plain OpenFL” and I’ll need to keep coding it on Apache Flex for now, targeting Adobe AIR. Since much of the base code is shared between the browser and the app versions, I was wondering if I could write it only once on OpenFL and get a swc library for compile time linking.

Is this possible?

You should be able to use any standard Flash class from OpenFL, even the ones it doesn’t support, but I understand if you use Flex then Haxe won’t be able to compile that

A SWC is really a “library.xml” file and a SWF, bundled inside a ZIP.

It looks like Haxe supports SWC output, you just need to compile using *.swc instead of *.swf in the output file for it to trigger it, you can do this with a custom template (or just hacking the openfl/templates directory temporarily)

Thank you, Joshua! Changing “.swf” to “.swc” at the Flash template worked! The library was correctly imported at Apache Flex and everything is working fine!