how are you doing?
A question please. I am using the button class in a Sprite class. Can I pass extra data to my button?
btn01:addEventListener("click", self.changeScene, data) |
btn01:addEventListener("click", self.changeScene, self, data) |
https://wiki.giderosmobile.com/index.php/EventDispatcher:addEventListenerBasically I want to avoid doing this for all my buttons:
btn02:addEventListener("click", function()
playSfx(true)
sceneManager:changeScene("levels", 1, transitions[13], easings[7])
end) |
Thank you
Comments
Likes: MoKaLux
This is a way of doing it but it adds another variable to the code.
I was hoping to get something like:
EventDispatcher:addEventListener(type,listener,data)
An example in the wiki could be useful.
I'll see if I can figure out something.
Likes: MoKaLux
Fragmenter - animated loop machine and IKONOMIKON - the memory game
Likes: keszegh, MoKaLux
do you have a very basic example for data?
EventDispatcher:addEventListener(type,listener,data)
for the wiki: https://wiki.giderosmobile.com/index.php/EventDispatcher:addEventListener