haxelib git hml https://github.com/profelis/hml.git
haxelib git stablexui-hml https://github.com/StablexUI/Hml master
- Values for metric properties can be specified with units (DIPS by default):
<Widget left="20%" top="100px" height="200dip" width="300" />
- StablexUI enums are imported automatically, so you can use them without fully qualified names:
<Box align="Right & Bottom" orientation="Horizontal" />
- Signal handlers
- If you dont need to use signal arguments
<Button onTrigger="trace('Button triggered!');" />
- If you need to use signal arguments, then you must define a closure with the same amount of arguments
<Button name="'myButton'" onTrigger=" function(btn) trace(btn.name + ' triggered'); " />
- If you need to define multiple handlers for the same signal
<Button> <onTrigger>trace('first handler');</onTrigger> <onTrigger>trace('second handler');</onTrigger> </Button>
destroyHml()
will be automatically called when youdispose()
widget created via xml
Put your xml files in <project_root>/hml/xml
.
Generated files will be written to <preject_root>/hml/gen
. Add it to your classpaths.
Now if your build.hxml
looks like this:
-main Main
-cp hml/gen
-lib someLib
-lib anotherLib
-swf bin/app.swf
You need to create hml.hxml
like this:
-main sx.hml.Generator
--no-output
-lib stablexui-hml
-cp hml/gen
-lib someLib
-lib anotherLib
-swf bin/app.swf
And run it with haxe hml.hxml
before haxe build.hxml
.
Add to your project configuration file this section:
<source path="hml/gen" />
<section if="hml">
<haxelib name="stablexui-hml" />
<app main="sx.hml.Generator"/>
<haxeflag name="--no-output"/>
</section>
And run openfl build <platform> -Dhml
before openfl build <platform>
.
See example