Using the Domain ActionScript class (as opposed to the C++ class of the same name) in Tamarin is actually really easy. This class isn’t available under Flash 9 for security reasons. It lets you load new ActionScript code at runtime, as our example will demonstrate. Dynamic code loading is pretty cool functionality – it could be used to implement a plugin system in an application, as the basis for a web server that executed files on demand, or as part of a programmer’s workbench written in AS.
I’m getting my feet wet in Tamarin, the open-source ActionScript 3 runtime from Adobe – same code that’s in Flash 9. It’s cool tech, and I’m ecstatic that they had the cajones to bring it out into the world – where it’ll definitely make the world a better place.
This gets kind of technical so I’ve hidden most of it behind the jump.
So I own this Griffin PowerMate, which is essentially a USB knob with a light under it. It’s pretty cool – solid construction, simple operation. But the software it comes with is a little limited, and it’s not been updated in a while. All I want, says I to myself, is to make iTunes pause when I push the knob.
Their software can’t do that, so I set out to fix the problem. It turns out that the PowerMate is a standard USB HID device, which are ridiculously easy to interface with (<15kb of C++ code for a nice self-contained class with comments). After maybe seven or eight hours of hacking, I now have a small tray app that I call “SuperMate.”
- PowerMate light functions as a disk activity light.
- Left/right turn advances to previous/next track in iTunes.
- Pushing the PowerMate pauses/unpauses iTunes.
- Takes up minimal system resources – around 5mb of RAM and almost zero CPU.
- Minimizes to system tray.
- Deals cleanly with plugging/unplugging the PowerMate, as well as failing gracefully if iTunes isn’t loaded.
- This program is public domain, and source is included.
- Supports XP/2000, and probably Vista, too.
You can download Supermate 1.00 here.
Any comments, bugfixes, enhancements are welcome. You can also donate a few bucks if you find it useful: