How could one detect what Display Object was touched within a row in onRowTouch?
Background:
* want to have two or three display object (level status indicators, one for each level) in one table view row
* the level status screen therefore will be 3 columns by X rows (depending on number of game levels)
* doing it this way as had performance problems with using horizontal scrollview per this question, and couldn’t find out how to make a table view horizontal per this question
* so challenge is want the TableView functionality of scrolling up/down, but when one clicks on a row, want to tell which display object within the row was clicked?
seem to have a work around with the following - not sure it’s the most elegant
local function levelButtonListener(event) lastLevelClicked = event.target.level return false end local function onRowTouch( event ) if "release" == phase then local levelNumberINeed = lastLevelClicked -- DO STUFF end end
seem to have a work around with the following - not sure it’s the most elegant
local function levelButtonListener(event) lastLevelClicked = event.target.level return false end local function onRowTouch( event ) if "release" == phase then local levelNumberINeed = lastLevelClicked -- DO STUFF end end
Add touch/tap handlers to the objects in the tableView that you want to respond to touch. They will come into their event handler as event.target and you can work with them that way.
Add touch/tap handlers to the objects in the tableView that you want to respond to touch. They will come into their event handler as event.target and you can work with them that way.