How to make a scrollview for level selection screen ?
\_W = display.contentWidth \_H = display.contentHeight local myGroup = display.newGroup() local startdragx = 0 local startgroupx = 0 local function startDrag( event ) local t = event.target local phase = event.phase if "began" == phase then t.isFocus = true t.x0 = event.x - t.x t.y0 = event.y - t.y startdragx = event.y startgroupx = myGroup.y elseif t.isFocus then if "moved" == phase then myGroup.y = startgroupx-(startdragx-event.y) elseif "ended" == phase or "cancelled" == phase then display.getCurrentStage():setFocus( nil ) t.isFocus = false end end return true end local function onTouch(e) if e.phase == "ended" then e.target:setFillColor(1,0.3,0.3) end end col = 0 row = 0 local level = {} for i = 1 ,50 do level[i] = display.newRect(0,0,65,65) level[i].x = col \* 75 + 50 level[i].y = row \* 75 +100 level[i]:addEventListener("touch",onTouch) myGroup:insert(level[i]) myGroup:addEventListener("touch",startDrag) col = col + 1 if col \> 3 then row = row + 1 col = 0 end end