I'm making a game using HaxeUI. I've designed a simple UI using XML definition. I need the button to execute a code that is unrelated to the UI elements, however, the parsed code from onClick property does not see any local identifiers defined in the area, in which the interface is being built.
How to work around this without the necessity to refrain from using XML definition?
Currently there isnt a method exactly as you describe, in the sense that you define your click handler in XML and that links to haxe code - there is this open issue which is essentially as you describe: https://github.com/haxeui/haxeui-core/issues/196 - and I think it would a useful addition.
There is however this method (using build macros to build a custom component):
This macro takes your xml (see below) and creates correctly typed member variables of anything that has an id.
This can then be used in code or xml freely:
or