Value Haxe to NodeTree

I wish I could modify a block value of a nodetree using a Haxe script. This is to vary the factor of a Mix Shader of a material. I tested the material_params example, it works, but it’s a continuous loop. I would like this to be a simple switch change during an event (example mouse click or other).
Thanks for your help

I’m sorry I’m not an expert with Haxe, so I might be wrong but, I think you can’t acces the “Value” node in the material editor to change it’s value while the game is running.
However you can set a material to an object with the logic node.
If you take the material_param example , go to the logic node editor window, remove or disable all exisiting node, then add the following nodes like this:

Don’t forget to check the nodeTree in Armory Traits:
Capture du 2020-05-03 01-54-19
The cube should switch from “materal” to 'material.001" when clicking the left mouse button.