Event sending and detection

haxe can directly use Event.send() to send events, so how to detect events without using logical nodes,

Hello! I join the question, how to do it?

package arm;

import armory.system.Event;
import iron.Scene;

class Test extends iron.Trait {
	var listener:TEvent = null;
	public function new() {
		listener = Event.add('Calc', onEvent);
	function onEvent() {
		trace('TEST HAXE');

Post edited by moderator: added Haxe syntax highlighting

Hi, Armory now has a page on the wiki and API documentation about events that should hopefully explain everything you need to know (the explanations didn’t exist yet when this thread was created, I wrote them only in November).

@YEVHEN_KARPIUK Is the code you shared an answer to the original (and your earlier) question about how to react to events in Haxe? Or do you also want to know how to send the Calc event in Haxe? You can use Event.send("Calc") to trigger the event and print TEST HAXE to the console.

1 Like

@timodriaan Hello.
Yes, this code is the answer to the original question (and mine).
Let me explain, if you have a logic node trait that sends a global event,

you can intercept it in a haxe script trait using this code

1 Like