A function defined in BBMOD_IEventListener.gml
on_event([_event, ]_listener)
Adds a listener for a specific event.
Name | Type | Description |
---|---|---|
_event | String |
The event name. If undefined , then the listener is executed on every event. |
_listener | Function |
A function executed when the event occurs. Should take the event data as the first argument and the event name as the second argument. |
Struct.BBMOD_IEventListener
Returns self
.
function Button() constructor
{
BBMOD_IEventListener();
}
var _button = new Button();
/// @desc This will be always executed, no matter the event type.
_button.on_event(function (_data, _eventName) {
show_debug_message("Got event " + string(_eventName) + "!");
});
/// @desc This will be executed only on event "click".
_button.on_event("click", function () {
show_debug_message("The button was clicked!");
});
BBMOD_IEventListener.off_event
Copyright © 2024, BlueBurn. Built on September 07, 2024 using GMDoc.