I am making a data view based off tileRow layout and I will have 3-5 columns
col1 col2 col3 col4
---------------------------------------
row1-1 row1-2 row1-3 row1-4
row2-1 row2-2 row2-3 row2-4
etc
At the moment I have set it up to use a for loop to create the items and set the width of each item 1/4 the total size of the container and this works great filling up an entire row with 4 quads so really the layout is like:
col1 col2 col3 col4
---------------------------------------
tile1 tile2 tile3 tile4
tile5 tile6 tile7 tile8
I want to add an event listener to trigger a function when a row is clicked. I am assuming I wont be able to really do this because each row is made up of 4 separate tiles.
Is there a better way to achieve the desired effect or should I just add a fifth column with a button that is clickable?
I can’t really use the list as I need multiple columns.
I would create a new Sprite which represents a row.
Take the rowSprite from a pool, and add the items for each row into it. Then you can put a click handler on the row, and grab the children of the currentTarget of the event.