Inline Markup
The mxhx.macros.MXHXComponent.withMarkup()
method allows a class to be generated from an inline string at compile-time.
var instance = MXHXComponent.withMarkup('
<f:LayoutGroup xmlns:mx="https://ns.mxhx.dev/2024/basic"
xmlns:f="https://ns.feathersui.com/mxhx">
<f:Button id="myButton" text="Click Me"/>
</f:LayoutGroup>
');
The id
values in the MXHX document will be made available on the instance returned by this method. The document contains a Feathers UI <f:Button>
tag with the id
of myButton
. We can access this field from our Haxe code, to do things like change the button's properties, add event listeners, etc.
instance.myButton.addEventListener(TriggerEvent.TRIGGER, event -> {
trace("triggered the button!");
});