3

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?

Gama11
  • 31,714
  • 9
  • 78
  • 100
Rella
  • 65,003
  • 109
  • 363
  • 636

2 Answers2

7

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.

Jeff Ward
  • 16,563
  • 6
  • 48
  • 57
1

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.

Allan
  • 3,339
  • 2
  • 21
  • 24