Hi
For .AddEventListener and .CallBack, is it possible to specify the event from a string?
For example
Then on the parent module
Then on the module code we have
Thanks
For .AddEventListener and .CallBack, is it possible to specify the event from a string?
For example
B4X:
'add an event
Sub AddEvent(module As Object, eventType as string)
'define the method to be called
Dim sEvent as string = $"game_${eventType}"$
Dim e as BANanoEvent
'define the callback
Dim cb as BANanoObject = BANano.CallBack(module, sEvent, Array(e))
'add the listener for the bananoobject
stage.AddEventListener(eventType, cb, false)
End Sub
Then on the parent module
B4X:
AddEvent(Me, "dblclick")
AddEvent(Me, "mouseover")
Then on the module code we have
B4X:
Sub game_dblclick(e As BANanoEvent)
Log(e)
End Sub
Sub game_mouseover(e as bananoevent)
'do something
End Sub
Thanks