Minimal Comps
I just pushed up a haXe port of Keiths excellent minimalcomps library.
It was a bit tricky to port, even though most of the hard work was done by the as3tohaxe tool I had to rewrite it from using inheritence (i.e. extending flash.display.Sprite) to using composition (i.e. wrap a flash.display.Sprite object and repoint all the methods to it) as haXe doesn’t like the getters and setters that AS3 (and the Flash Player) uses. Or rather, it doesn’t like to override them as getters and setters behave very differently in haXe. It does give some unexpected features (bugs some might call them, see the “known issues” below) but generally it works quite well.
Another issue I’ve come across while doing this is that when I want to use the components in a project I now have to add the font which is required by minimalcomps to it, and if I want to add other swf-based assets I would have to merge the minimalcomps-font into it. So it’s a bit of extra work which could be avoided if the resource management of flash9+ based targets could be fixed.
But as long as it’s a simple project with no other assets it’s really as simple as adding these two lines to the hxml:
-lib minimalcomps
-swf-lib font/pf_ronda_seven.swf
And then you can use it like this:
var vbox = new minimalcomps.VBox( this );
new minimalcomps.HUISlider( vbox , 0 , 0 , "Slide this!" );
new minimalcomps.HUISlider( vbox , 0 , 0 , "And that!" );
And you’ll get this!
Known Issues:
- VBox won’t position Knob and InputText properly
- ColorChooser doesn’t position it’s popup correctly
- Event targets isn’t the object but the _comp
- “-swf-lib font/pf_ronda_seven.swf” must be added when compiling
TODO
- Fix the known issues (duh!).
- Add the missing components (last I checked the FPSMeter was added since my port).
- Generate some docs would be nice.
- Add it to haxelib as soon as I figure out what my password was (if anyone who can reset it reads this, please do!)
sitting in a pleasant sofa is fun.
combine for double the fun.