I’m creating objects that have Listeners, most are buttons.
I want to attach something to each button for me to identify, upon touch.
Here’s what I’ve started, and you will see the comments have what I would love to accomplish…
local ui = require("ui")
local function IdentifyTouchedObject(event)
print("You just touched the button with ID: ");
end
backBtn = ui.newButton{
default = "backButton.png",
over = "backButton\_over.png",
onRelease = IdentifyTouchedObject
}
anotherBtn = ui.newButton{
default = "redButton.png",
over = "redButton\_over.png",
onRelease = IdentifyTouchedObject
}
I used the “ui” library, since buttons are easy to create, but I do mean anything I can consider “touch-able”.
Is there a way to attach an ID or some Name to a button, or object, so when touched I can log it? [import]uid: 154122 topic_id: 28316 reply_id: 328316[/import]