Using touch events.
When the phase of the event "started" (the user simply touched the screen), allow the movement of three pages (actual, forward and backward).
if event.phase == "began" then page1.canMove = true page2.canMove = true page3.canMove = true initial = {} initial.x = event.x end
If pages are allowed to move:
if page1.canMove == true then
Move three pages according to the x parameter of the event.
page1.x = page1.x + event.x - initial.x page2.x = page2.x + event.x - initial.x page3.x = page3.x + event.x - initial.x
when the phase of the event is βcompletedβ (the user releases his finger), remove the permission to move.
if event.phase == "end" then page1.canMove = false page2.canMove = false page3.canMove = false end
and adjust the pages, depending on where they are.
I just came up with this solution if someone can contribute to make it more complete: D.
source share