Happy Winter Solstice! I've got a present that I think you'll like: basic
cross-platform workers!
In a nutshell, this will let you kick work out of your app's main thread and event loop, without having to poke around the web for gists. :-D If you're making a game with an AI or an audio signal processor, or some hardcore personal finance software, this code will hopefully make it easier than ever to free up your main thread and keep things responsive. (And if it doesn't, you can certainly edit it until it does.)
The basic idea is, if you want to write code that can run in a worker thread, you extend the BasicWorker class and override its receive functioIn to get things going. Don't write that main function; BasicWorker handles the entry point. (I agree that this is weird, but the alternative made it really simple for folks to shoot themselves in the foot.)
To use that worker, you make an instance of a BasicBoss subclass in your main app, start it up and you're golden. :-)
Now, depending on your target platform, the constructor for BasicBoss accepts either a Bytes object containing the worker SWF or JS file, or a class that extends BasicWorker. I think that's annoying and error-prone, so I wrote the Golem class.
Golem is nuts. It's a macro that takes a string like './projects/MyWorker.hxml', runs over to that HXML file, finds a build target inside that's labeled ##GOLEM## that targets the same platform as the current build, and if the platform is Flash or JavaScript, it'll run that build target, find the output SWF or JS file and adds that to the main project as a resource. And then it'll return it. You don't even need to deal with fetching the resource. Golem isn't necessary, but if you've got multiple target platforms, you might want to give it a shot.
I literally just put this online, and I'm interested in feedback. So far, I want to thank clemos and David Mouton for the gist they were playing with in a recent thread, and Sven Bergström, who helped me figure out the message passing for neko and C++.
(Yes, it's completely OpenFL compatible. Why wouldn't it be?)