Can we use compiled Haxe swf's swc's in Ac

2019-04-12 05:05发布

问题:

Can we use compiled Haxe swf's swc's in Actionscript as normal libs? I have a swf compiled from haxe code (I can try to compile it into something else SWC for ex) I want to use it as lib in AS3.

Is it possible?

If yes how to do it?

回答1:

Yes, you can, the performance increase is worth it, and it's surprisingly easy! I got 3-4X speed-up on both a simple sum-of-primes algorithm and a complex 2D bin packing algorithm.

I've posted an entire example project on github -- from Haxe source and compile scripts to usage in an AS3 project. Check it out: https://github.com/jcward/HaxeSWCExample

Update: Note that the 3-4X gains were on the desktop platform. Sadly on mobile platforms, the gains were much more modest.



回答2:

Yes you can. If it is a library then you would want to export it as a SWC and then just make sure that where ever you are compiling from knows the path to the SWC.